예제 #1
0
        /// <summary>
        /// Adds a primitive to this collision skin - the primitive is
        /// copied (so you can pass in something on the stack, or delete
        /// the original) - perhaps using reference counting.  Returns the
        /// primitive index, or -1 if failure Also takes that material ID
        /// and the properties used when a collision ID is USER_DEFINED
        /// </summary>
        /// <param name="prim"></param>
        /// <param name="matID"></param>
        /// <param name="matProps"></param>
        /// <returns>int</returns>
        private int AddPrimitive(Primitive prim, int matID, MaterialProperties matProps)
        {
            Primitive newPrim = prim.Clone();

            if (newPrim == null)
                throw new ArgumentException("Not able to clone primitive!");

            materialIDs.Add(matID);
            materialProperties.Add(matProps);

            primitivesOldWorld.Add(prim.Clone());
            primitivesNewWorld.Add(prim.Clone());
            primitivesLocal.Add(newPrim);

            UpdateWorldBoundingBox();

            return materialIDs.Count - 1;
        }
예제 #2
0
        /// <summary>
        /// Adds a primitive to this collision skin - the primitive is
        /// copied (so you can pass in something on the stack, or delete
        /// the original) - perhaps using reference counting.  Returns the
        /// primitive index, or -1 if failure Also takes that material ID
        /// and the properties used when a collision ID is USER_DEFINED
        /// </summary>
        /// <param name="prim"></param>
        /// <param name="matID"></param>
        /// <param name="matProps"></param>
        /// <returns></returns>
        public int AddPrimitive(Primitive prim, int matID, MaterialProperties matProps)
        {
            Primitive newPrim = prim.Clone();

            if (newPrim == null)
            {
                System.Diagnostics.Debug.WriteLine("CollisionSkin.AddPrimitive Unable to clone primitive");
                return -1;
            }

            primitivesOldWorld.Add(prim.Clone());
            primitivesNewWorld.Add(prim.Clone());
            primitivesLocal.Add(newPrim);

            materialIDs.Add(matID);
            materialProperties.Add(matProps);

            UpdateWorldBoundingBox();

            return materialIDs.Count - 1;
        }