当前位置: 首页>>代码示例>>C#>>正文


C# Loader.Parse方法代码示例

本文整理汇总了C#中Loader.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# Loader.Parse方法的具体用法?C# Loader.Parse怎么用?C# Loader.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Loader的用法示例。


在下文中一共展示了Loader.Parse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EquipmentTemplate

        public EquipmentTemplate(Loader l)
        {
            ID = l.ID;

            foreach (Instruction i in l.Parse())
                Load(l, i);
        }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:7,代码来源:EquipmentTemplate.cs

示例2: Skeleton

        public Skeleton(Loader l)
        {
            ID = l.ID;

            foreach (Instruction i in l.Parse())
                Load(l, i);
        }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:7,代码来源:Skeleton.cs

示例3: ModelObject

        public ModelObject(Loader l)
        {
            GeometryModel3D model = null;
            MeshGeometry3D geometry = null;

            List<Point3D> vertices = new List<Point3D>();
            List<Vector3D> normals = new List<Vector3D>();
            List<Point> textures = new List<Point>();

            foreach (Instruction i in l.Parse())
            {
                switch (i.Type)
                {
                    case "mtllib":
                        MaterialLibrary = l.Find(i.Arg).Load<MaterialLibrary>();
                        break;
                    case "usemtl":
                        model.Material = MaterialLibrary.Materials[i.Arg];
                        break;
                    case "o":
                        model = new GeometryModel3D();
                        Geometries.Add(i.Arg, model);
                        model.Geometry = geometry = new MeshGeometry3D();
                        break;
                    case "f":
                        foreach (string index in i.Args)
                        {
                            string[] values = index.Split('/');
                            geometry.Positions.Add(vertices[int.Parse(values[0]) - 1]);
                            if (values.Length > 1 && values[1] != "")
                                geometry.TextureCoordinates.Add(
                                    textures[int.Parse(values[1]) - 1]);
                            if (values.Length > 2)
                                geometry.Normals.Add(normals[int.Parse(values[2]) - 1]);
                        }
                        break;
                    case "v": // Vertex
                        vertices.Add(new Point3D(i.Double(), i.Double(), i.Double()));
                        break;
                    case "vn": // Vertex normal
                        normals.Add(new Vector3D(i.Double(), i.Double(), i.Double()));
                        break;
                    case "vt": // Vertex texture coordinate
                        textures.Add(new Point(i.Double(), i.Double()));
                        break;
                    case "g": // Group
                        // TODO: Add support for object groups
                        break;
                    case "s": // Smooth
                        // Not supported, just ignore
                        break;
                    default:
                        break;
                }
            }
        }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:56,代码来源:ModelObject.cs

示例4: Control

 public Control(Loader l)
 {
     foreach (Instruction i in l.Parse())
     {
         switch (i.Type)
         {
             case "name":
                 Name = i.String();
                 break;
             case "startup":
                 if (i.Bool())
                     Event.Once(typeof(Game), Game.Loaded, (sender, e) => Start());
                 break;
         }
     }
 }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:16,代码来源:Control.cs

示例5: MaterialLibrary

        public MaterialLibrary(Loader l)
        {
            MaterialGroup group = null;
            DiffuseMaterial diffuse = null;
            SpecularMaterial specular = null;

            foreach (Instruction i in l.Parse())
            {
                switch (i.Type)
                {
                    case "newmtl":
                        group = new MaterialGroup();

                        diffuse = new DiffuseMaterial();
                        group.Children.Add(diffuse);
                        specular = new SpecularMaterial();
                        group.Children.Add(specular);

                        Materials.Add(i.Arg, group);
                        break;
                    case "Ns":
                        specular.SpecularPower = i.Double();
                        break;
                    case "d":
                    case "Tr":
                        diffuse.Brush.Opacity = i.Float();
                        break;
                    case "Ka":
                        diffuse.AmbientColor = i.Color();
                        break;
                    case "Kd":
                        diffuse.Brush = new SolidColorBrush(i.Color());
                        break;
                    case "Ks":
                        specular.Brush = new SolidColorBrush(i.Color());
                        break;
                    // TODO: UV Maps
                    case "illum":
                    case "Ni": // Index of Refraction
                        // Unsupported, ignore
                        break;
                    default:
                        // Unrecognized symbol
                        break;
                }
            }
        }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:47,代码来源:MaterialLibrary.cs

示例6: Cam

        public Cam(Loader l)
        {
            // TODO: Set transformation to follow Scene
            CamAnimation anim = null;

            foreach (Instruction i in l.Parse())
            {
                switch (i.Type)
                {
                    case "track":
                        TrackTarget = i.Bool();
                        break;
                    case "pos":
                        if (anim == null)
                            Position = i.Point3D();
                        else
                            anim.Position = i.Point3D();
                        break;
                    case "tar":
                        if (anim == null)
                            Target = i.Point3D();
                        else
                            anim.Target = i.Point3D();
                        break;
                    case "dir":
                        if (anim == null)
                            LookDirection = i.Vector3D();
                        else
                            anim.LookDirection = i.Vector3D();
                        break;
                    case "anim":
                        Animations[i.String()] = anim = new CamAnimation(this);
                        break;
                    case "ease":
                        anim.Easing = Easings.Map[i.String()];
                        break;
                    case "abs":
                        anim.IsAbsolute = i.Bool();
                        break;
                    case "dur":
                        anim.Duration = i.Double();
                        break;
                    default:
                        break;
                }
            }
        }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:47,代码来源:Cam.cs

示例7: AddonTemplate

        public AddonTemplate(Loader l)
        {
            ID = l.ID;

            foreach (Instruction i in l.Parse())
            {
                switch (i.Type)
                {
                    case "node":
                        Node = i.String();
                        break;
                    case "model":
                        Model = l.Find(i.String()).Load<ModelObject>();
                        break;
                }
            }
        }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:17,代码来源:AddonTemplate.cs

示例8: InteractionTemplate

 public InteractionTemplate(Loader l)
 {
     foreach (Instruction i in l.Parse())
         Load(l, i);
 }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:5,代码来源:InteractionTemplate.cs


注:本文中的Loader.Parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。