Пример #1
0
 protected override void OnNodeSet()
 {
     base.OnNodeSet();
     DomNodeUtil.SetVector(DomNode, Schema.gameObjectType.scaleAttribute, new Vec3F(0.4f, 0.4f, 0.4f));
     UpdateTransform();
     TransformationType = TransformationTypes.Translation;
 }
Пример #2
0
        /// <summary>
        /// Raises the NodeSet event and performs custom processing</summary>
        protected override void OnNodeSet()
        {
            base.OnNodeSet();

            Box boxValue = DomNodeUtil.GetBox(DomNode, Schema.meshType.boundingBoxAttribute);

            m_boundingBox = boxValue.IsEmpty ? new Cached <Box>(CalculateBoundingBox) : new Cached <Box>(CalculateBoundingBox, boxValue);
        }
Пример #3
0
        private void SetVector(DomNode domNode, ChildInfo metaElement, AttributeInfo attributeInfo, Vec3F v)
        {
            if (domNode == null)
            {
                domNode = DomNode.GetChild(metaElement);
            }

            DomNodeUtil.SetVector(domNode, attributeInfo, v);
        }
Пример #4
0
        public static DomNode Create(Uri reference, string name, Vec3F mins, Vec3F maxs)
        {
            var result = new DomNode(CellRefST.Type);

            result.SetAttribute(CellRefST.refAttribute, reference);
            result.SetAttribute(CellRefST.nameAttribute, name);
            DomNodeUtil.SetVector(result, CellRefST.captureMinsAttribute, mins);
            DomNodeUtil.SetVector(result, CellRefST.captureMaxsAttribute, maxs);
            return(result);
        }
Пример #5
0
Файл: Node.cs Проект: zparr/ATF
        /// <summary>
        /// Calculates bounding box of node's children</summary>
        /// <returns>Bounding box of children</returns>
        public Box CalculateBoundingBox()
        {
            var box = new Box();

            foreach (IBoundable boundable in DomNode.Children.AsIEnumerable <IBoundable>())
            {
                box.Extend(boundable.BoundingBox);
            }

            box.Transform(Transform);
            DomNodeUtil.SetBox(DomNode, Schema.nodeType.boundingBoxAttribute, box);

            return(box);
        }
Пример #6
0
        private Vec3F GetVector(DomNode domNode, AttributeInfo attributeInfo)
        {
            Vec3F result;

            if (domNode != null)
            {
                DomNodeUtil.GetVector(domNode, attributeInfo, out result);
            }
            else
            {
                result = new Vec3F();
            }

            return(result);
        }
Пример #7
0
        /// <summary>
        /// Calculates the geometry's bounding box</summary>
        /// <returns>Bounding box for geometry</returns>
        public Box CalculateBoundingBox()
        {
            Box box = new Box();

            foreach (DataSet dataSet in DataSets)
            {
                if (dataSet.Name == "position")
                {
                    box.Extend(dataSet.Data);
                    break;
                }
            }
            DomNodeUtil.SetBox(DomNode, Schema.meshType.boundingBoxAttribute, box);
            return(box);
        }
Пример #8
0
        /// <summary>
        /// Performs initialization when the adapter's node is set.
        /// This method is called each time the adapter is connected to its underlying node.
        /// Typically overridden by creators of DOM adapters.</summary>
        protected override void OnNodeSet()
        {
            base.OnNodeSet();

            Box boxValue = DomNodeUtil.GetBox(DomNode, Schema.meshType.boundingBoxAttribute);

            if (boxValue.IsEmpty)
            {
                m_boundingBox = new Cached <Box>(CalculateBoundingBox); // don't set value and force to compute
            }
            else
            {
                m_boundingBox = new Cached <Box>(CalculateBoundingBox, boxValue); // non-default value found, use it
            }
        }
Пример #9
0
        /// <summary>
        /// Performs custom actions on NodeSet events.
        /// Called after successfully attaching to internal DOM object.</summary>
        protected override void OnNodeSet()
        {
            base.OnNodeSet();

            // Initialize scale to (1, 1, 1) if missing
            DomNode.SetAttributeIfDefault(Schema.nodeType.scaleAttribute, new Vec3F(1, 1, 1));

            m_rotation     = DomNode.GetChild(Schema.nodeType.rotEulChild);
            m_rotationAxis = DomNode.GetChild(Schema.nodeType.rotAxisEulChild);
            Transform      = TransformUtils.CalcTransform(this);

            Box boxValue = DomNodeUtil.GetBox(DomNode, Schema.nodeType.boundingBoxAttribute);

            if (boxValue.IsEmpty)
            {
                m_boundingBox = new Cached <Box>(CalculateBoundingBox); // don't set value and force to compute
            }
            else
            {
                m_boundingBox = new Cached <Box>(CalculateBoundingBox, boxValue); // non-default value found, use it
            }
        }