diff --git a/lslopt/lslbasefuncs.py b/lslopt/lslbasefuncs.py index 7062e6f..5b599df 100644 --- a/lslopt/lslbasefuncs.py +++ b/lslopt/lslbasefuncs.py @@ -74,6 +74,7 @@ b64_re = re.compile(ur'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2,3})?') ZERO_VECTOR = Vector((0.0, 0.0, 0.0)) ZERO_ROTATION = Quaternion((0.0, 0.0, 0.0, 1.0)) NULL_KEY = u'00000000-0000-0000-0000-000000000000' +TOUCH_INVALID_TEXCOORD = Vector((-1.0, -1.0, 0.0)) Infinity = float('inf') Indet = Infinity * 0 diff --git a/lslopt/lslextrafuncs.py b/lslopt/lslextrafuncs.py index f3f2fdd..52a7ce0 100644 --- a/lslopt/lslextrafuncs.py +++ b/lslopt/lslextrafuncs.py @@ -19,7 +19,8 @@ from lslcommon import Key, Vector #, Quaternion from lslbasefuncs import ELSLCantCompute, isinteger, iskey, islist, \ - isvector, isstring, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION, cond + isvector, isstring, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION, \ + TOUCH_INVALID_TEXCOORD, cond #isfloat, isrotation TouchEvents = ('touch', 'touch_start', 'touch_end') @@ -101,7 +102,7 @@ def llDetectedTouchFace(idx, event=None): assert isinteger(idx) if 0 <= idx <= 15 and (event in TouchEvents or event is None): raise ELSLCantCompute - return 0 + return -1 if event in DetectionEvents and 0 <= idx <= 15 else 0 def llDetectedTouchNormal(idx, event=None): assert isinteger(idx) @@ -119,13 +120,15 @@ def llDetectedTouchST(idx, event=None): assert isinteger(idx) if 0 <= idx <= 15 and (event in TouchEvents or event is None): raise ELSLCantCompute - return ZERO_VECTOR + return TOUCH_INVALID_TEXCOORD if event in DetectionEvents \ + and 0 <= idx <= 15 else ZERO_VECTOR def llDetectedTouchUV(idx, event=None): assert isinteger(idx) if 0 <= idx <= 15 and (event in TouchEvents or event is None): raise ELSLCantCompute - return ZERO_VECTOR + return TOUCH_INVALID_TEXCOORD if event in DetectionEvents \ + and 0 <= idx <= 15 else ZERO_VECTOR def llDetectedType(idx, event=None): assert isinteger(idx)