diff options
author | Teravus Ovares | 2008-03-21 05:54:56 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-03-21 05:54:56 +0000 |
commit | 0cb05c19529a110c996387bae8ba2047c3232851 (patch) | |
tree | 6c1b59a1ed51ff50629865b76146126b52c24c2f /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | * Removed more encoding faults. (diff) | |
download | opensim-SC-0cb05c19529a110c996387bae8ba2047c3232851.zip opensim-SC-0cb05c19529a110c996387bae8ba2047c3232851.tar.gz opensim-SC-0cb05c19529a110c996387bae8ba2047c3232851.tar.bz2 opensim-SC-0cb05c19529a110c996387bae8ba2047c3232851.tar.xz |
* Updated ray tracing code. It's now good enough to use when the XYZ vector components of the scale have a difference of less then 4.5 meters.
* When a new prim is created and raytracing is called for, raytrace from the camera position to the ground in the direction of the Norm(RayEnd - RayStart).
* If we got a hit based on our camera, create the new prim at the edge of the prim we hit.
* Don't raytrace if the difference between any component of the vector exceeds 4.5meters.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7948a6f..94a4e31 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -31,6 +31,7 @@ using System.Drawing; | |||
31 | using System.Drawing.Imaging; | 31 | using System.Drawing.Imaging; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Timers; | 33 | using System.Timers; |
34 | using Axiom.Math; | ||
34 | using libsecondlife; | 35 | using libsecondlife; |
35 | using libsecondlife.Packets; | 36 | using libsecondlife.Packets; |
36 | using OpenJPEGNet; | 37 | using OpenJPEGNet; |
@@ -1079,7 +1080,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
1079 | if (target != null) | 1080 | if (target != null) |
1080 | { | 1081 | { |
1081 | pos = target.AbsolutePosition; | 1082 | pos = target.AbsolutePosition; |
1082 | // TODO: Raytrace here | 1083 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); |
1084 | //target.Scale.X | ||
1085 | if (Math.Abs(target.Scale.X - target.Scale.Y) > 4.5f | ||
1086 | || Math.Abs(target.Scale.Y - target.Scale.Z) > 4.5f | ||
1087 | || Math.Abs(target.Scale.Z - target.Scale.X) > 4.5f) | ||
1088 | { | ||
1089 | |||
1090 | // for now lets use the old method here as the new method works by using the largest scale vector | ||
1091 | // component as the radius of a sphere and produces wide results if there's a huge difference | ||
1092 | // between the x/y/z vector components | ||
1093 | |||
1094 | // If one scale component is less then .21m, it's likely being used as a thin block and therefore | ||
1095 | // the raytracing would produce a wide result. | ||
1096 | |||
1097 | |||
1098 | } | ||
1099 | else | ||
1100 | { | ||
1101 | // TODO: Raytrace better here | ||
1102 | LLVector3 direction = LLVector3.Norm(RayEnd - RayStart); | ||
1103 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | ||
1104 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | ||
1105 | EntityIntersection ei = m_innerScene.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); | ||
1106 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | ||
1107 | |||
1108 | if (ei.HitTF) | ||
1109 | { | ||
1110 | pos = new LLVector3(ei.ipoint.x, ei.ipoint.y, ei.ipoint.z); | ||
1111 | } | ||
1112 | |||
1113 | } | ||
1083 | return pos; | 1114 | return pos; |
1084 | } | 1115 | } |
1085 | else | 1116 | else |