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


C# Mesh.GetSkeleton方法代码示例

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


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

示例1: UpdateSkinning

 private void UpdateSkinning(Mesh mesh)
 {
     for (int i = 0; i < boneNames.Count; i++)
     {
         Matrix4f boneMat = mesh.GetSkeleton().GetBone(i).GetBoneMatrix();
         SetUniform(boneNames[i], boneMat);
     }
 }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:8,代码来源:AnimatedShader.cs

示例2: Update

 public override void Update(Environment environment, Camera cam, Mesh mesh)
 {
     base.Update(environment, cam, mesh);
     if (mesh != null && mesh.GetSkeleton() != null)
     {
         if (!isSkinningInit)
         {
             InitSkinning(mesh);
             isSkinningInit = true;
         }
         UpdateSkinning(mesh);
     }
 }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:13,代码来源:AnimatedShader.cs

示例3: SaveMesh


//.........这里部分代码省略.........
            }
            writer.WriteAttributeString(TOKEN_HAS_POSITIONS, (facesP.Count > 0).ToString());
            writer.WriteAttributeString(TOKEN_HAS_NORMALS, (facesN.Count > 0).ToString());
            writer.WriteAttributeString(TOKEN_HAS_TEXCOORDS, (facesT0.Count > 0).ToString());

            writer.WriteStartElement(TOKEN_VERTICES);

            for (int i = 0; i < positions.Count; i++)
            {
                writer.WriteStartElement(TOKEN_POSITION);
                writer.WriteAttributeString("x", positions[i].x.ToString());
                writer.WriteAttributeString("y", positions[i].y.ToString());
                writer.WriteAttributeString("z", positions[i].z.ToString());
                writer.WriteEndElement();
            }
            if (mesh.GetAttributes().HasAttribute(VertexAttributes.NORMALS))
            {
                for (int i = 0; i < normals.Count; i++)
                {
                    writer.WriteStartElement(TOKEN_NORMAL);
                    writer.WriteAttributeString("x", normals[i].X.ToString());
                    writer.WriteAttributeString("y", normals[i].Y.ToString());
                    writer.WriteAttributeString("z", normals[i].Z.ToString());
                    writer.WriteEndElement();
                }
            }
            if (mesh.GetAttributes().HasAttribute(VertexAttributes.TEXCOORDS0))
            {
                for (int i = 0; i < texcoords0.Count; i++)
                {
                    writer.WriteStartElement(TOKEN_TEXCOORD0);
                    writer.WriteAttributeString("x", texcoords0[i].X.ToString());
                    writer.WriteAttributeString("y", texcoords0[i].Y.ToString());
                    writer.WriteEndElement();
                }
            }
            if (mesh.GetAttributes().HasAttribute(VertexAttributes.TEXCOORDS1))
            {
                for (int i = 0; i < texcoords1.Count; i++)
                {
                    writer.WriteStartElement(TOKEN_TEXCOORD1);
                    writer.WriteAttributeString("x", texcoords1[i].X.ToString());
                    writer.WriteAttributeString("y", texcoords1[i].Y.ToString());
                    writer.WriteEndElement();
                }
            }

            writer.WriteEndElement(); // vertices

            writer.WriteStartElement(TOKEN_FACES);

            int stride = 3;
            if (facesT1.Count > 0)
                stride++;
            for (int i = 0; i < facesP.Count; i+=stride)
            {
                writer.WriteStartElement(TOKEN_FACE);
                writer.WriteAttributeString("i0", facesP[i].ToString() + "/" +
                                                  facesN[i].ToString() + "/" +
                                                  facesT0[i].ToString() +
                                                  ((facesT1.Count > 0) ? "/" + facesT1[i].ToString() : ""));

                writer.WriteAttributeString("i1", facesP[i+1].ToString() + "/" +
                                                  facesN[i + 1].ToString() + "/" +
                                                  facesT0[i + 1].ToString() +
                                                  ((facesT1.Count > 0) ? "/" + facesT1[i + 1].ToString() : ""));

                writer.WriteAttributeString("i2", facesP[i + 2].ToString() + "/" +
                                                  facesN[i + 2].ToString() + "/" +
                                                  facesT0[i + 2].ToString() +
                                                  ((facesT1.Count > 0) ? "/" + facesT1[i + 2].ToString() : ""));
                writer.WriteEndElement();
            }

            writer.WriteEndElement(); // faces

            if (boneAssigns.Count > 0)
            {
                writer.WriteStartElement(TOKEN_BONE_ASSIGNS);
                for (int i = 0; i < boneAssigns.Count; i++)
                {
                    writer.WriteStartElement(TOKEN_BONE_ASSIGN);
                    writer.WriteAttributeString(TOKEN_VERTEXINDEX, boneAssigns[i].GetVertexIndex().ToString());
                    writer.WriteAttributeString(TOKEN_BONEINDEX, boneAssigns[i].GetBoneIndex().ToString());
                    writer.WriteAttributeString(TOKEN_BONEWEIGHT, boneAssigns[i].GetBoneWeight().ToString());
                    writer.WriteEndElement(); // bone assign
                }
                writer.WriteEndElement(); // bone assigns
            }
            if (mesh.GetSkeleton() != null)
            {
                if (!skeletons.Contains(mesh.GetSkeleton()))
                    skeletons.Add(mesh.GetSkeleton());
                writer.WriteStartElement(TOKEN_SKELETON_ASSIGN);
                writer.WriteAttributeString(TOKEN_ID, skeletons.IndexOf(mesh.GetSkeleton()).ToString());
                writer.WriteEndElement(); // skeleton assign
            }

            writer.WriteEndElement(); // end mesh
        }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:101,代码来源:ApxExporter.cs


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