Пример #1
0
        public static bool FindSurfaceIntersection(CSGBrush brush, Vector3 modelTranslation, Int32 surfaceIndex, Vector3 rayStart, Vector3 rayEnd, out SurfaceIntersection intersection)
        {
            intersection = null;
            if (!brush ||
                InternalCSGModelManager.External.RayCastIntoBrushSurface == null)
            {
                return(false);
            }

            if (!InternalCSGModelManager.External.RayCastIntoBrushSurface(brush.brushID,
                                                                          surfaceIndex,
                                                                          rayStart - modelTranslation,
                                                                          rayEnd - modelTranslation,
                                                                          out intersection))
            {
                return(false);
            }

            if (BrushTraits.IsSurfaceSelectable(brush, surfaceIndex))
            {
                return(false);
            }

            intersection.worldIntersection += modelTranslation;
            intersection.plane.Translate(modelTranslation);
            return(true);
        }
Пример #2
0
        public static bool FindSurfaceIntersection(CSGBrush brush, Vector3 modelTranslation, Int32 surfaceIndex, Vector2 screenPos, out SurfaceIntersection intersection)
        {
            var worldRay  = HandleUtility.GUIPointToWorldRay(screenPos);
            var rayStart  = worldRay.origin;
            var rayVector = (worldRay.direction * (Camera.current.farClipPlane - Camera.current.nearClipPlane));
            var rayEnd    = rayStart + rayVector;

            return(FindSurfaceIntersection(brush, modelTranslation, surfaceIndex, rayStart, rayEnd, out intersection));
        }
Пример #3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SurfaceIntersection obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }