示例#1
0
        public CompositeGameObjectFromFile Build(Stream stream, IFileParserPlugin parser)
        {
            parser.Parse(stream, this);
            var colors = new Queue <Vector4>();

            colors.Enqueue(V4Colors.Red);
            colors.Enqueue(V4Colors.Blue);
            colors.Enqueue(V4Colors.Green);
            colors.Enqueue(V4Colors.Yellow);

            foreach (var com in components)
            {
                var tag    = new ElementTag("Obj_" + Guid.NewGuid());//DateTime.Now.Ticks
                var entity = manager.CreateEntity(tag);
                var cc     = new List <IGraphicComponent>();
                cc.Add(com);
                cc.Add(EntityBuilders.GetObjGroupsRender());
                cc.Add(EntityBuilders.GetTransformation());
                //var material = new PositionColorsComponent();

                //material.Colors = new Vector4[com.Positions.Length];
                //for (var i =0;i < com.Positions.Length; ++i) {
                //    material.Colors[i] = V4Colors.Red;
                //}

                cc.Add(ColorComponent.CreateDiffuse(V4Colors.Red));
                cc.Add(new ManipulatableComponent());

                entity.AddComponents(cc);
                entity.AddComponents(others);
                gobj.AddEntity(tag);
            }

            return(gobj); //new SingleGameObject(tag, info.File.Name);
        }
示例#2
0
 public ImportFileInfo(FileInfo file, IFileParserPlugin parser, bool watching)
 {
     File       = file;
     Parser     = parser;
     IsWatching = watching;
 }
示例#3
0
 public ParserTypeItem(IFileParserPlugin i)
 {
     this.parser = i;
 }
示例#4
0
 public CompositeGameObjectFromFile Build(FileInfo file, IFileParserPlugin parser)
 {
     using (var str = File.OpenRead(file.FullName)) {
         return(Build(str, parser));
     }
 }