aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-03 19:21:26 +0000
committerTeravus Ovares2007-12-03 19:21:26 +0000
commit5061808afc72f86c7dca9641d30a67905fd84b23 (patch)
tree3bf670ddccfe807e428531df59ed07f493fbea2d /OpenSim/Region
parentThis is a simple patch which just renames an IClientAPI method to (diff)
downloadopensim-SC_OLD-5061808afc72f86c7dca9641d30a67905fd84b23.zip
opensim-SC_OLD-5061808afc72f86c7dca9641d30a67905fd84b23.tar.gz
opensim-SC_OLD-5061808afc72f86c7dca9641d30a67905fd84b23.tar.bz2
opensim-SC_OLD-5061808afc72f86c7dca9641d30a67905fd84b23.tar.xz
* Now using interpolation to expand the 256x256 heightfield data to 512x512 before it's passed to ODE.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs110
1 files changed, 102 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 59b8ff0..e8ee33c 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -899,11 +899,65 @@ namespace OpenSim.Region.Physics.OdePlugin
899 } 899 }
900 } 900 }
901 901
902 // Resize using the nearest neighbor method 902 // Resize using interpolation
903 // Going to be doing interpolation here soon 903
904
905 // This particular way is quick but it only works on a multiple of the original 904 // This particular way is quick but it only works on a multiple of the original
906 905
906 // The idea behind this method can be described with the following diagrams
907 // second pass and third pass happen in the same loop really.. just separated
908 // them to show what this does.
909
910 // First Pass
911 // ResultArr:
912 // 1,1,1,1,1,1
913 // 1,1,1,1,1,1
914 // 1,1,1,1,1,1
915 // 1,1,1,1,1,1
916 // 1,1,1,1,1,1
917 // 1,1,1,1,1,1
918
919 // Second Pass
920 // ResultArr2:
921 // 1,,1,,1,,1,,1,,1,
922 // ,,,,,,,,,,
923 // 1,,1,,1,,1,,1,,1,
924 // ,,,,,,,,,,
925 // 1,,1,,1,,1,,1,,1,
926 // ,,,,,,,,,,
927 // 1,,1,,1,,1,,1,,1,
928 // ,,,,,,,,,,
929 // 1,,1,,1,,1,,1,,1,
930 // ,,,,,,,,,,
931 // 1,,1,,1,,1,,1,,1,
932
933 // Third pass fills in the blanks
934 // ResultArr2:
935 // 1,1,1,1,1,1,1,1,1,1,1,1
936 // 1,1,1,1,1,1,1,1,1,1,1,1
937 // 1,1,1,1,1,1,1,1,1,1,1,1
938 // 1,1,1,1,1,1,1,1,1,1,1,1
939 // 1,1,1,1,1,1,1,1,1,1,1,1
940 // 1,1,1,1,1,1,1,1,1,1,1,1
941 // 1,1,1,1,1,1,1,1,1,1,1,1
942 // 1,1,1,1,1,1,1,1,1,1,1,1
943 // 1,1,1,1,1,1,1,1,1,1,1,1
944 // 1,1,1,1,1,1,1,1,1,1,1,1
945 // 1,1,1,1,1,1,1,1,1,1,1,1
946
947 // X,Y = .
948 // X+1,y = ^
949 // X,Y+1 = *
950 // X+1,Y+1 = #
951
952 // Filling in like this;
953 // .*
954 // ^#
955 // 1st .
956 // 2nd *
957 // 3rd ^
958 // 4th #
959 // on single loop.
960
907 float[,] resultarr2 = new float[512, 512]; 961 float[,] resultarr2 = new float[512, 512];
908 for (int y = 0; y < 256; y++) 962 for (int y = 0; y < 256; y++)
909 { 963 {
@@ -912,12 +966,52 @@ namespace OpenSim.Region.Physics.OdePlugin
912 resultarr2[y*2,x*2] = resultarr[y,x]; 966 resultarr2[y*2,x*2] = resultarr[y,x];
913 967
914 if (y < 256) 968 if (y < 256)
915 resultarr2[(y*2)+1,x*2] = resultarr[y,x]; 969 {
970 if (y + 1 < 256)
971 {
972 if (x + 1 < 256)
973 {
974 resultarr2[(y * 2) + 1, x * 2] = ((resultarr[y, x] + resultarr[y + 1, x] + resultarr[y, x+1] + resultarr[y+1, x+1])/4);
975 }
976 else
977 {
978 resultarr2[(y * 2) + 1, x * 2] = ((resultarr[y, x] + resultarr[y + 1, x]) / 2);
979 }
980 }
981 else
982 {
983 resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x];
984 }
985 }
916 if (x < 256) 986 if (x < 256)
917 resultarr2[y*2,(x*2)+1] = resultarr[y,x]; 987 {
918 988 if (x + 1 < 256)
919 if (x<256 && y < 256) 989 {
920 resultarr2[(y*2)+1,(x*2)+1] = resultarr[y,x]; 990 if (y + 1 < 256)
991 {
992 resultarr2[y * 2, (x * 2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + resultarr[y, x + 1] + resultarr[y + 1, x + 1]) / 4);
993 }
994 else
995 {
996 resultarr2[y * 2, (x * 2) + 1] = ((resultarr[y, x] + resultarr[y, x + 1]) / 2);
997 }
998 }
999 else
1000 {
1001 resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x];
1002 }
1003 }
1004 if (x < 256 && y < 256)
1005 {
1006 if ((x + 1 < 256) && (y + 1 < 256))
1007 {
1008 resultarr2[(y * 2) + 1, (x * 2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + resultarr[y, x + 1] + resultarr[y + 1, x + 1]) / 4);
1009 }
1010 else
1011 {
1012 resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x];
1013 }
1014 }
921 } 1015 }
922 1016
923 } 1017 }