diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 279 |
2 files changed, 9 insertions, 281 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 445fef8..0b9c45f 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | |||
@@ -445,7 +445,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
445 | m_disabled = false; | 445 | m_disabled = false; |
446 | 446 | ||
447 | // The body doesn't already have a finite rotation mode set here | 447 | // The body doesn't already have a finite rotation mode set here |
448 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null) | 448 | if ((!m_angularlock.ApproxEquals(Vector3.One, 0.0f)) && _parent == null) |
449 | { | 449 | { |
450 | createAMotor(m_angularlock); | 450 | createAMotor(m_angularlock); |
451 | } | 451 | } |
@@ -1121,7 +1121,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1121 | { | 1121 | { |
1122 | d.Mass m2; | 1122 | d.Mass m2; |
1123 | d.MassSetZero(out m2); | 1123 | d.MassSetZero(out m2); |
1124 | d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); | 1124 | d.MassSetBoxTotal(out m2, prm.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); |
1125 | 1125 | ||
1126 | d.Quaternion quat = new d.Quaternion(); | 1126 | d.Quaternion quat = new d.Quaternion(); |
1127 | quat.W = prm._orientation.W; | 1127 | quat.W = prm._orientation.W; |
@@ -1184,11 +1184,6 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1184 | prm.m_collisionscore = 0; | 1184 | prm.m_collisionscore = 0; |
1185 | prm.m_disabled = false; | 1185 | prm.m_disabled = false; |
1186 | 1186 | ||
1187 | // The body doesn't already have a finite rotation mode set here | ||
1188 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | ||
1189 | { | ||
1190 | prm.createAMotor(m_angularlock); | ||
1191 | } | ||
1192 | prm.Body = Body; | 1187 | prm.Body = Body; |
1193 | _parent_scene.ActivatePrim(prm); | 1188 | _parent_scene.ActivatePrim(prm); |
1194 | } | 1189 | } |
@@ -1235,7 +1230,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1235 | m_disabled = false; | 1230 | m_disabled = false; |
1236 | 1231 | ||
1237 | // The body doesn't already have a finite rotation mode set here | 1232 | // The body doesn't already have a finite rotation mode set here |
1238 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | 1233 | if ((!m_angularlock.ApproxEquals(Vector3.One, 0f)) && _parent == null) |
1239 | { | 1234 | { |
1240 | createAMotor(m_angularlock); | 1235 | createAMotor(m_angularlock); |
1241 | } | 1236 | } |
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index cee16bf..8cc7f28 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | |||
@@ -2042,7 +2042,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2042 | x = x - offsetX + 1f; | 2042 | x = x - offsetX + 1f; |
2043 | y = y - offsetY + 1f; | 2043 | y = y - offsetY + 1f; |
2044 | 2044 | ||
2045 | index = (int)((int)x * ((int)Constants.RegionSize + 2) + (int)y); | 2045 | index = (int)((int)x * ((int)m_regionHeight +3) + (int)y); |
2046 | 2046 | ||
2047 | if (index < TerrainHeightFieldHeights[heightFieldGeom].Length) | 2047 | if (index < TerrainHeightFieldHeights[heightFieldGeom].Length) |
2048 | { | 2048 | { |
@@ -3639,274 +3639,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3639 | get { return false; } | 3639 | get { return false; } |
3640 | } | 3640 | } |
3641 | 3641 | ||
3642 | /* godd try.. but not a fix | ||
3643 | #region ODE Specific Terrain Fixes | ||
3644 | private float[] ResizeTerrain512NearestNeighbour(float[] heightMap) | ||
3645 | { | ||
3646 | float[] returnarr = new float[262144]; | ||
3647 | float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y]; | ||
3648 | |||
3649 | // Filling out the array into its multi-dimensional components | ||
3650 | for (int y = 0; y < WorldExtents.Y; y++) | ||
3651 | { | ||
3652 | for (int x = 0; x < WorldExtents.X; x++) | ||
3653 | { | ||
3654 | resultarr[y, x] = heightMap[y * (int)WorldExtents.Y + x]; | ||
3655 | } | ||
3656 | } | ||
3657 | |||
3658 | // Resize using Nearest Neighbour | ||
3659 | |||
3660 | // This particular way is quick but it only works on a multiple of the original | ||
3661 | |||
3662 | // The idea behind this method can be described with the following diagrams | ||
3663 | // second pass and third pass happen in the same loop really.. just separated | ||
3664 | // them to show what this does. | ||
3665 | |||
3666 | // First Pass | ||
3667 | // ResultArr: | ||
3668 | // 1,1,1,1,1,1 | ||
3669 | // 1,1,1,1,1,1 | ||
3670 | // 1,1,1,1,1,1 | ||
3671 | // 1,1,1,1,1,1 | ||
3672 | // 1,1,1,1,1,1 | ||
3673 | // 1,1,1,1,1,1 | ||
3674 | |||
3675 | // Second Pass | ||
3676 | // ResultArr2: | ||
3677 | // 1,,1,,1,,1,,1,,1, | ||
3678 | // ,,,,,,,,,, | ||
3679 | // 1,,1,,1,,1,,1,,1, | ||
3680 | // ,,,,,,,,,, | ||
3681 | // 1,,1,,1,,1,,1,,1, | ||
3682 | // ,,,,,,,,,, | ||
3683 | // 1,,1,,1,,1,,1,,1, | ||
3684 | // ,,,,,,,,,, | ||
3685 | // 1,,1,,1,,1,,1,,1, | ||
3686 | // ,,,,,,,,,, | ||
3687 | // 1,,1,,1,,1,,1,,1, | ||
3688 | |||
3689 | // Third pass fills in the blanks | ||
3690 | // ResultArr2: | ||
3691 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3692 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3693 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3694 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3695 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3696 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3697 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3698 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3699 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3700 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3701 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3702 | |||
3703 | // X,Y = . | ||
3704 | // X+1,y = ^ | ||
3705 | // X,Y+1 = * | ||
3706 | // X+1,Y+1 = # | ||
3707 | |||
3708 | // Filling in like this; | ||
3709 | // .* | ||
3710 | // ^# | ||
3711 | // 1st . | ||
3712 | // 2nd * | ||
3713 | // 3rd ^ | ||
3714 | // 4th # | ||
3715 | // on single loop. | ||
3716 | |||
3717 | float[,] resultarr2 = new float[512, 512]; | ||
3718 | for (int y = 0; y < WorldExtents.Y; y++) | ||
3719 | { | ||
3720 | for (int x = 0; x < WorldExtents.X; x++) | ||
3721 | { | ||
3722 | resultarr2[y * 2, x * 2] = resultarr[y, x]; | ||
3723 | |||
3724 | if (y < WorldExtents.Y) | ||
3725 | { | ||
3726 | resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x]; | ||
3727 | } | ||
3728 | if (x < WorldExtents.X) | ||
3729 | { | ||
3730 | resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x]; | ||
3731 | } | ||
3732 | if (x < WorldExtents.X && y < WorldExtents.Y) | ||
3733 | { | ||
3734 | resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x]; | ||
3735 | } | ||
3736 | } | ||
3737 | } | ||
3738 | |||
3739 | //Flatten out the array | ||
3740 | int i = 0; | ||
3741 | for (int y = 0; y < 512; y++) | ||
3742 | { | ||
3743 | for (int x = 0; x < 512; x++) | ||
3744 | { | ||
3745 | if (resultarr2[y, x] <= 0) | ||
3746 | returnarr[i] = 0.0000001f; | ||
3747 | else | ||
3748 | returnarr[i] = resultarr2[y, x]; | ||
3749 | |||
3750 | i++; | ||
3751 | } | ||
3752 | } | ||
3753 | |||
3754 | return returnarr; | ||
3755 | } | ||
3756 | |||
3757 | private float[] ResizeTerrain512Interpolation(float[] heightMap) | ||
3758 | { | ||
3759 | float[] returnarr = new float[262144]; | ||
3760 | float[,] resultarr = new float[512,512]; | ||
3761 | |||
3762 | // Filling out the array into its multi-dimensional components | ||
3763 | for (int y = 0; y < 256; y++) | ||
3764 | { | ||
3765 | for (int x = 0; x < 256; x++) | ||
3766 | { | ||
3767 | resultarr[y, x] = heightMap[y * 256 + x]; | ||
3768 | } | ||
3769 | } | ||
3770 | |||
3771 | // Resize using interpolation | ||
3772 | |||
3773 | // This particular way is quick but it only works on a multiple of the original | ||
3774 | |||
3775 | // The idea behind this method can be described with the following diagrams | ||
3776 | // second pass and third pass happen in the same loop really.. just separated | ||
3777 | // them to show what this does. | ||
3778 | |||
3779 | // First Pass | ||
3780 | // ResultArr: | ||
3781 | // 1,1,1,1,1,1 | ||
3782 | // 1,1,1,1,1,1 | ||
3783 | // 1,1,1,1,1,1 | ||
3784 | // 1,1,1,1,1,1 | ||
3785 | // 1,1,1,1,1,1 | ||
3786 | // 1,1,1,1,1,1 | ||
3787 | |||
3788 | // Second Pass | ||
3789 | // ResultArr2: | ||
3790 | // 1,,1,,1,,1,,1,,1, | ||
3791 | // ,,,,,,,,,, | ||
3792 | // 1,,1,,1,,1,,1,,1, | ||
3793 | // ,,,,,,,,,, | ||
3794 | // 1,,1,,1,,1,,1,,1, | ||
3795 | // ,,,,,,,,,, | ||
3796 | // 1,,1,,1,,1,,1,,1, | ||
3797 | // ,,,,,,,,,, | ||
3798 | // 1,,1,,1,,1,,1,,1, | ||
3799 | // ,,,,,,,,,, | ||
3800 | // 1,,1,,1,,1,,1,,1, | ||
3801 | |||
3802 | // Third pass fills in the blanks | ||
3803 | // ResultArr2: | ||
3804 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3805 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3806 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3807 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3808 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3809 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3810 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3811 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3812 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3813 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3814 | // 1,1,1,1,1,1,1,1,1,1,1,1 | ||
3815 | |||
3816 | // X,Y = . | ||
3817 | // X+1,y = ^ | ||
3818 | // X,Y+1 = * | ||
3819 | // X+1,Y+1 = # | ||
3820 | |||
3821 | // Filling in like this; | ||
3822 | // .* | ||
3823 | // ^# | ||
3824 | // 1st . | ||
3825 | // 2nd * | ||
3826 | // 3rd ^ | ||
3827 | // 4th # | ||
3828 | // on single loop. | ||
3829 | |||
3830 | float[,] resultarr2 = new float[512,512]; | ||
3831 | for (int y = 0; y < (int)Constants.RegionSize; y++) | ||
3832 | { | ||
3833 | for (int x = 0; x < (int)Constants.RegionSize; x++) | ||
3834 | { | ||
3835 | resultarr2[y*2, x*2] = resultarr[y, x]; | ||
3836 | |||
3837 | if (y < (int)Constants.RegionSize) | ||
3838 | { | ||
3839 | if (y + 1 < (int)Constants.RegionSize) | ||
3840 | { | ||
3841 | if (x + 1 < (int)Constants.RegionSize) | ||
3842 | { | ||
3843 | resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] + | ||
3844 | resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); | ||
3845 | } | ||
3846 | else | ||
3847 | { | ||
3848 | resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x])/2); | ||
3849 | } | ||
3850 | } | ||
3851 | else | ||
3852 | { | ||
3853 | resultarr2[(y*2) + 1, x*2] = resultarr[y, x]; | ||
3854 | } | ||
3855 | } | ||
3856 | if (x < (int)Constants.RegionSize) | ||
3857 | { | ||
3858 | if (x + 1 < (int)Constants.RegionSize) | ||
3859 | { | ||
3860 | if (y + 1 < (int)Constants.RegionSize) | ||
3861 | { | ||
3862 | resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + | ||
3863 | resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); | ||
3864 | } | ||
3865 | else | ||
3866 | { | ||
3867 | resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y, x + 1])/2); | ||
3868 | } | ||
3869 | } | ||
3870 | else | ||
3871 | { | ||
3872 | resultarr2[y*2, (x*2) + 1] = resultarr[y, x]; | ||
3873 | } | ||
3874 | } | ||
3875 | if (x < (int)Constants.RegionSize && y < (int)Constants.RegionSize) | ||
3876 | { | ||
3877 | if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize)) | ||
3878 | { | ||
3879 | resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + | ||
3880 | resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); | ||
3881 | } | ||
3882 | else | ||
3883 | { | ||
3884 | resultarr2[(y*2) + 1, (x*2) + 1] = resultarr[y, x]; | ||
3885 | } | ||
3886 | } | ||
3887 | } | ||
3888 | } | ||
3889 | //Flatten out the array | ||
3890 | int i = 0; | ||
3891 | for (int y = 0; y < 512; y++) | ||
3892 | { | ||
3893 | for (int x = 0; x < 512; x++) | ||
3894 | { | ||
3895 | if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x])) | ||
3896 | { | ||
3897 | m_log.Warn("[ODE SCENE]: Non finite heightfield element detected. Setting it to 0"); | ||
3898 | resultarr2[y, x] = 0; | ||
3899 | } | ||
3900 | returnarr[i] = resultarr2[y, x]; | ||
3901 | i++; | ||
3902 | } | ||
3903 | } | ||
3904 | |||
3905 | return returnarr; | ||
3906 | } | ||
3907 | |||
3908 | #endregion | ||
3909 | */ | ||
3910 | public override void SetTerrain(float[] heightMap) | 3642 | public override void SetTerrain(float[] heightMap) |
3911 | { | 3643 | { |
3912 | if (m_worldOffset != Vector3.Zero && m_parentScene != null) | 3644 | if (m_worldOffset != Vector3.Zero && m_parentScene != null) |
@@ -4006,9 +3738,10 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
4006 | 3738 | ||
4007 | } | 3739 | } |
4008 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); | 3740 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); |
4009 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight, | 3741 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, |
4010 | (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, | 3742 | heightmapWidth, heightmapHeight, |
4011 | offset, thickness, wrap); | 3743 | (int)heightmapWidthSamples, (int)heightmapHeightSamples, |
3744 | scale, offset, thickness, wrap); | ||
4012 | 3745 | ||
4013 | d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); | 3746 | d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); |
4014 | GroundGeom = d.CreateHeightfield(space, HeightmapData, 1); | 3747 | GroundGeom = d.CreateHeightfield(space, HeightmapData, 1); |
@@ -4032,7 +3765,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
4032 | 3765 | ||
4033 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); | 3766 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); |
4034 | d.GeomSetRotation(GroundGeom, ref R); | 3767 | d.GeomSetRotation(GroundGeom, ref R); |
4035 | d.GeomSetPosition(GroundGeom, pOffset.X + regionsizeX * 0.5f, pOffset.Y + regionsizeY * 0.5f, 0); | 3768 | d.GeomSetPosition(GroundGeom, pOffset.X + regionsizeX * 0.5f, pOffset.Y + regionsizeY * 0.5f, 0f); |
4036 | IntPtr testGround = IntPtr.Zero; | 3769 | IntPtr testGround = IntPtr.Zero; |
4037 | if (RegionTerrain.TryGetValue(pOffset, out testGround)) | 3770 | if (RegionTerrain.TryGetValue(pOffset, out testGround)) |
4038 | { | 3771 | { |