Ejemplo n.º 1
0
        public void AddInstance(int uuid, Vector3 position, Vector3 rotation)
        {
            if (mInstances.Any(w => w.Uuid == uuid))
                return;

            var inst = new WmoInstance(uuid, position, rotation, mRoot);

            lock (mInstances)
            {
                mInstances.Add(inst);
                mInstancesChanged = true;
            }
        }
Ejemplo n.º 2
0
        public void AddInstance(int uuid, Vector3 position, Vector3 rotation)
        {
            if (mInstances.Any(w => w.Uuid == uuid))
            {
                return;
            }

            var inst = new WmoInstance(uuid, position, rotation, mRoot);

            lock (mInstances)
            {
                mInstances.Add(inst);
                mInstancesChanged = true;
            }
        }
Ejemplo n.º 3
0
        public void AddInstance(int uuid, Vector3 position, Vector3 rotation)
        {
            lock (mInstances)
            {
                WmoInstance instance;
                if (mInstances.TryGetValue(uuid, out instance))
                {
                    ++instance.ReferenceCount;
                    return;
                }
            }

            var inst = new WmoInstance(uuid, position, rotation, mRoot);

            lock (mInstances)
            {
                mInstances.Add(uuid, inst);
                mInstancesChanged = true;
            }
        }
Ejemplo n.º 4
0
        public bool Intersect(IntersectionParams parameters, ref Ray globalRay, out float distance, out WmoInstance instance)
        {
            distance = float.MaxValue;
            instance = null;

            if (mInstances == null)
            {
                return(false);
            }

            lock (mInstances)
            {
                foreach (var inst in mInstances.Values)
                {
                    float dist;
                    if (inst.Intersects(parameters, ref globalRay, out dist) && dist < distance)
                    {
                        distance = dist;
                        instance = inst;
                    }
                }
            }

            return(instance != null);
        }