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


C# Geometry.GetInstance方法代码示例

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


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

示例1: Collada

        public Collada(IEnumerable<List<Triangle>> meshes, Joint rootjoint, IEnumerable<XElement> extradata, string path, DateTime creattime, DateTime modtime)
        {
            basepath = path;
            List<Geometry> geometries = new List<Geometry>();
            List<Node> scenenodes = new List<Node>();
            List<Node> modelnodes = new List<Node>();
            List<SkinController> controllers = new List<SkinController>();
            Skeleton skeleton = rootjoint == null ? null : new Skeleton("model_skel", rootjoint);
            Animation animation = rootjoint == null ? null : skeleton.GetAnimatedBones().Count() != 0 ? new Animation(skeleton) : null;
            List<InstanceBase> instnodes = new List<InstanceBase>();

            foreach (List<Triangle> mesh in meshes.Where(m => m.Count != 0))
            {
                Geometry geometry = new Geometry(this, CreateSymbol("model_mesh"), mesh);
                Node node = new Node(geometry.ID + "_node", geometry.GetInstance());
                geometries.Add(geometry);
                if (skeleton != null)
                {
                    SkinController controller = new SkinController(geometry, skeleton);
                    controllers.Add(controller);
                    node = new Node(controller.ID + "_node", controller.GetInstance());
                }
                modelnodes.Add(node);
            }

            Node modelroot = new Node("model", modelnodes, skeleton);
            scenenodes.Add(modelroot);

            this.Add(
                new XElement(ns + "COLLADA",
                    new XAttribute("version", "1.4.1"),
                    new XElement(ns + "asset",
                        new XElement(ns + "contributor",
                            new XElement(ns + "author", "IonFx")
                        ),
                        new XElement(ns + "created", creattime.ToString("O")),
                        new XElement(ns + "modified", modtime.ToString("O")),
                        new XElement(ns + "up_axis", "Z_UP")
                    ),
                    new XElement(ns + "library_images", Materials.Values.Select(m => m.Effect.Image)),
                    new XElement(ns + "library_effects", Materials.Values.Select(m => m.Effect)),
                    new XElement(ns + "library_materials", Materials.Values),
                    new XElement(ns + "library_geometries",
                        geometries,
                        extradata == null ? null : new XElement(ns + "extra",
                            new XElement(ns + "technique",
                                new XAttribute("profile", "RS5-Extra"),
                                extradata
                            )
                        )
                    ),
                    controllers.Count == 0 ? null : new XElement(ns + "library_controllers", controllers),
                    animation == null ? null : new XElement(ns + "library_animations", animation),
                    new XElement(ns + "library_visual_scenes",
                        new XElement(ns + "visual_scene",
                            new XAttribute("id", "visual_scene"),
                            scenenodes
                        )
                    ),
                    new XElement(ns + "scene",
                        new XElement(ns + "instance_visual_scene",
                            new XAttribute("url", "#visual_scene")
                        )
                    )
                )
            );
        }
开发者ID:klightspeed,项目名称:RS5-Extractor,代码行数:67,代码来源:Collada.cs


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