Example #1
0
 /// <summary>
 /// Constructor using PrimInput and offset</summary>
 /// <param name="input">PrimInput</param>
 /// <param name="offset">Offset</param>
 public PrimInput(PrimInput input, int offset)
 {
     m_semantic = input.Semantic;
     m_offset   = offset;
     m_source   = input.DataSource;
     m_atgiName = input.Name;
 }
Example #2
0
 /// <summary>
 /// Constructor using PrimInput and offset</summary>
 /// <param name="input">PrimInput</param>
 /// <param name="offset">Offset</param>
 public PrimInput(PrimInput input, int offset)
 {
     m_semantic = input.Semantic;
     m_offset = offset;
     m_source = input.DataSource;
     m_atgiName = input.Name;
 }
Example #3
0
File: Mesh.cs Project: Joxx0r/ATF
        /// <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();

            DomNode vertexChild = this.DomNode.GetChild(Schema.mesh.verticesChild);
            foreach (DomNode dome in vertexChild.GetChildList(Schema.vertices.inputChild))
            {
                PrimInput input = new PrimInput(dome, this);
                m_inputs.Add(input);
            }

            m_boundingBox = CalculateBoundingBox();
        }
Example #4
0
File: Mesh.cs Project: zparr/ATF
        /// <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();

            DomNode vertexChild = this.DomNode.GetChild(Schema.mesh.verticesChild);

            foreach (DomNode dome in vertexChild.GetChildList(Schema.vertices.inputChild))
            {
                PrimInput input = new PrimInput(dome, this);
                m_inputs.Add(input);
            }

            m_boundingBox = CalculateBoundingBox();
        }
Example #5
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();
            Visible = true;
            DomNodeType domtype = this.DomNode.Type;
            ChildInfo inputChildInfo = domtype.GetChildInfo("input");
            Mesh mesh = GetParentAs<Mesh>();

            int maxoffset = -1;
            // get input child info.            
            foreach (DomNode inputNode in DomNode.GetChildList(inputChildInfo))
            {
                PrimInput pinput = new PrimInput(inputNode, mesh);
                if (pinput.Offset > maxoffset)
                    maxoffset = pinput.Offset;
                if (pinput.Semantic == "VERTEX")
                {                    
                    foreach (PrimInput vinput in mesh.VertexInputs)
                    {
                        PrimInput input = new PrimInput(vinput, pinput.Offset);
                        m_inputs.Add(input);
                    }                    
                }
                else
                {
                    m_inputs.Add(pinput);
                }
            }

            m_bindingCount = maxoffset + 1;
            
            // prim type
            string type = DomNode.ToString();
            m_primitiveType =  type.Substring(type.LastIndexOf(':') + 1).ToUpper();
            if (m_primitiveType == "POLYLIST")
                m_primitiveType = "POLYGONS";

            // indices
            AttributeInfo pattrib = DomNode.Type.GetAttributeInfo("p");
            m_indices = Tools.ULongToInt(GetAttribute<ulong[]>(pattrib));
            
            // material
            AttributeInfo mtrlAttrib =DomNode.Type.GetAttributeInfo("material");
            string mtrl = GetAttribute<string>(mtrlAttrib);
            Geometry geom = DomNode.Parent.Parent.Cast<Geometry>();
            m_effect = geom.Effects[mtrl];
                      
            // vcount, element sizes
            AttributeInfo vcountAttrib = DomNode.Type.GetAttributeInfo("vcount");
            if (vcountAttrib != null)
            {
                m_sizes = Tools.ULongToInt(GetAttribute<ulong[]>(vcountAttrib));                
            }
            else
                m_sizes = new int[]{3};

            //count
            AttributeInfo countAttrib = DomNode.Type.GetAttributeInfo("count");
            m_count =(int) GetAttribute<ulong>(countAttrib);

            // name
            AttributeInfo nameAttrib = DomNode.Type.GetAttributeInfo("name");
            m_name = GetAttribute<string>(nameAttrib);

          
        }
Example #6
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();
            Visible = true;
            DomNodeType domtype        = this.DomNode.Type;
            ChildInfo   inputChildInfo = domtype.GetChildInfo("input");
            Mesh        mesh           = GetParentAs <Mesh>();

            int maxoffset = -1;

            // get input child info.
            foreach (DomNode inputNode in DomNode.GetChildList(inputChildInfo))
            {
                PrimInput pinput = new PrimInput(inputNode, mesh);
                if (pinput.Offset > maxoffset)
                {
                    maxoffset = pinput.Offset;
                }
                if (pinput.Semantic == "VERTEX")
                {
                    foreach (PrimInput vinput in mesh.VertexInputs)
                    {
                        PrimInput input = new PrimInput(vinput, pinput.Offset);
                        m_inputs.Add(input);
                    }
                }
                else
                {
                    m_inputs.Add(pinput);
                }
            }

            m_bindingCount = maxoffset + 1;

            // prim type
            string type = DomNode.ToString();

            m_primitiveType = type.Substring(type.LastIndexOf(':') + 1).ToUpper();
            if (m_primitiveType == "POLYLIST")
            {
                m_primitiveType = "POLYGONS";
            }

            // indices
            AttributeInfo pattrib = DomNode.Type.GetAttributeInfo("p");

            m_indices = Tools.ULongToInt(GetAttribute <ulong[]>(pattrib));

            // material
            AttributeInfo mtrlAttrib = DomNode.Type.GetAttributeInfo("material");
            string        mtrl       = GetAttribute <string>(mtrlAttrib);
            Geometry      geom       = DomNode.Parent.Parent.Cast <Geometry>();

            m_effect = geom.Effects[mtrl];

            // vcount, element sizes
            AttributeInfo vcountAttrib = DomNode.Type.GetAttributeInfo("vcount");

            if (vcountAttrib != null)
            {
                m_sizes = Tools.ULongToInt(GetAttribute <ulong[]>(vcountAttrib));
            }
            else
            {
                m_sizes = new int[] { 3 }
            };

            //count
            AttributeInfo countAttrib = DomNode.Type.GetAttributeInfo("count");

            m_count = (int)GetAttribute <ulong>(countAttrib);

            // name
            AttributeInfo nameAttrib = DomNode.Type.GetAttributeInfo("name");

            m_name = GetAttribute <string>(nameAttrib);
        }