Esempio n. 1
0
        public override bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags)
        {
            // If the caller asked us to ignore certain objects we should check flags
            if ((ignoreFlags & ModelIgnoreFlags.M2) != ModelIgnoreFlags.Nothing)
            {
                // M2 models are not taken into account for LoS calculation if caller requested their ignoring.
                if ((Flags & (uint)ModelFlags.M2) != 0)
                {
                    return(false);
                }
            }

            // small M2 workaround, maybe better make separate class with virtual intersection funcs
            // in any case, there's no need to use a bound tree if we only have one submodel
            if (groupModels.Count == 1)
            {
                return(groupModels[0].IntersectRay(ray, ref distance, stopAtFirstHit));
            }

            WModelRayCallBack isc = new WModelRayCallBack(groupModels);

            groupTree.IntersectRay(ray, isc, ref distance, stopAtFirstHit);
            return(isc.hit);
        }