Esempio n. 1
0
        public void Add(Element child)
        {
            OffsetElement offset = child as OffsetElement;

            if (offset != null)
            {
                m_offset = offset;
                return;
            }

            ChannelsElement channels = child as ChannelsElement;

            if (channels != null)
            {
                m_channels = channels;
                m_bvh.JointList.Add(this);
                return;
            }

            CompositeElement joint = child as CompositeElement;

            if (joint != null)
            {
                m_joint_list.Add(joint);
                return;
            }

            throw new NotSupportedException();
        }
Esempio n. 2
0
        private Visual3D CreateMarkerTree(CompositeElement joint)
        {
            ContainerUIElement3D marker = CreateMarker(1, 0.05);

            joint.Visual = marker;

            Transform3DGroup transforms = new Transform3DGroup();

            marker.Transform = transforms;

            transforms.Children.Add(new MatrixTransform3D());

            Vector3D offset = joint.Offset.Value;

            transforms.Children.Add(new TranslateTransform3D(offset));

            foreach (CompositeElement child in joint.JointList)
            {
                marker.Children.Add(CreateMarkerTree(child));
            }

            return(marker);
        }
Esempio n. 3
0
 public JointFrameList(BVH bvh, CompositeElement joint)
 {
     m_bvh   = bvh;
     m_joint = joint;
 }
Esempio n. 4
0
        public void Load(Stream stream)
        {
            using (StreamReader reader = new StreamReader(stream))
            {
                Element         current = null;
                Stack <Element> stack   = new Stack <Element>();

                while (!reader.EndOfStream)
                {
                    string   line   = reader.ReadLine().Trim();
                    string[] fields = line.Split(' ', '\t');
                    switch (fields[0])
                    {
                    case "":
                        continue;

                    case "{":
                        stack.Push(current);
                        continue;

                    case "}":
                        stack.Pop();
                        continue;

                    case "HIERARCHY":
                        continue;

                    case "ROOT":
                        current = new RootElement(this, fields[1]);
                        break;

                    case "JOINT":
                        current = new JointElement(this, fields[1]);
                        break;

                    case "End":
                        current = new EndSiteElement(this, fields[1]);
                        break;

                    case "OFFSET":
                        current = new OffsetElement(fields[1], fields[2], fields[3]);
                        break;

                    case "CHANNELS":
                        current = new ChannelsElement(fields);
                        break;

                    case "MOTION":
                        continue;

                    case "Frames:":
                        current = new FramesElement(fields[1]);
                        break;

                    case "Frame":
                        current = new FrameTimeElement(fields[2]);
                        break;

                    default:
                        current = new FrameElement(this, fields);
                        break;
                    }

                    if (stack.Count == 0)
                    {
                        this.Add(current);
                    }
                    else
                    {
                        CompositeElement parent = stack.Peek() as CompositeElement;
                        parent.Add(current);
                    }
                }
            }
        }