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


C# ByteReader.GetFloat方法代码示例

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


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

示例1: GetVertex

 private Vertex GetVertex(ByteReader io)
 {
     Vertex vertex;
     vertex.Position=io.GetVector3();
     vertex.Normal=io.GetVector3();
     vertex.UV=io.GetVector2();
     vertex.DeformType=(VERTEX_DEFORM)io.GetByte();
     vertex.BoneIndices=new int[4];
     vertex.BoneWeights=new float[4];
     switch(vertex.DeformType)
     {
         case VERTEX_DEFORM.BDEF1:
             vertex.BoneIndices[0]=GetBoneIndex(io);
             break;
         case VERTEX_DEFORM.BDEF2:
             vertex.BoneIndices[0]=GetBoneIndex(io);
             vertex.BoneIndices[1]=GetBoneIndex(io);
             vertex.BoneWeights[0]=io.GetFloat();
             break;
         case VERTEX_DEFORM.BDEF4:
             vertex.BoneIndices[0]=GetBoneIndex(io);
             vertex.BoneIndices[1]=GetBoneIndex(io);
             vertex.BoneIndices[2]=GetBoneIndex(io);
             vertex.BoneIndices[3]=GetBoneIndex(io);
             vertex.BoneWeights[0]=io.GetFloat();
             vertex.BoneWeights[1]=io.GetFloat();
             vertex.BoneWeights[2]=io.GetFloat();
             vertex.BoneWeights[3]=io.GetFloat();
             break;
         case VERTEX_DEFORM.SDEF:
             throw new PmxException("not implemented");
     }
     vertex.EdgeFactor=io.GetFloat();
     return vertex;
 }
开发者ID:ousttrue,项目名称:csmeshio,代码行数:35,代码来源:Pmx.cs

示例2: GetBone

 private Bone GetBone(ByteReader io)
 {
     var bone=new Bone();
     bone.Name=GetText(io);
     bone.EnglishName=GetText(io);
     bone.Position=io.GetVector3();
     bone.ParentIndex=GetBoneIndex(io);
     bone.Layer=io.GetInt();
     bone.Flags=(BONEFLAG)io.GetUShort();
     if(bone.HasFlag(BONEFLAG.HAS_TAILBONE)){
         bone.TailBoneIndex=GetBoneIndex(io);
     }
     else{
         bone.TailOffset=io.GetVector3();
     }
     if(bone.HasFlag(BONEFLAG.ROTATION_EFFECTED)
             || bone.HasFlag(BONEFLAG.TRANSLATION_EFFECTED)){
         bone.EffectIndex=GetBoneIndex(io);
         bone.EffectFactor=io.GetFloat();
     }
     if(bone.HasFlag(BONEFLAG.HAS_FIXEDAXIS)){
         bone.FixedAxis=io.GetVector3();
     }
     if(bone.HasFlag(BONEFLAG.HAS_LOCALAXIS)){
         bone.LocalAxisX=io.GetVector3();
         bone.LocalAxisZ=io.GetVector3();
     }
     if(bone.HasFlag(BONEFLAG.DEFORM_EXTERNAL_PARENT)){
         bone.ExternalParentKey=io.GetInt();
     }
     if(bone.HasFlag(BONEFLAG.HAS_IK)){
         var ik=new IKSolver();
         bone.IKSolver=ik;
         ik.TargetIndex=GetBoneIndex(io);
         ik.Iterations=io.GetInt();
         ik.UnitRadian=io.GetFloat();
         int Count=io.GetInt();
         ik.Chains=Enumerable.Range(1, Count).Select(_
                 =>{
                 var link=new IKLink();
                 link.BoneIndex=GetBoneIndex(io);
                 link.IsLimited=io.GetByte()==0 ? false : true;
                 if(link.IsLimited){
                 link.MinEulerRadians=io.GetVector3();
                 link.MaxEulerRadians=io.GetVector3();
                 }
                 return link;
                 }).ToArray();
     }
     return bone;
 }
开发者ID:ousttrue,项目名称:csmeshio,代码行数:51,代码来源:Pmx.cs

示例3: GetMaterial

 private Material GetMaterial(ByteReader io)
 {
     var material=new Material();
     material.Name=GetText(io);
     material.EnglishName=GetText(io);
     material.Diffuse=io.GetVector4();
     material.Specular=io.GetVector3();
     material.SpecularFactor=io.GetFloat();
     material.Ambient=io.GetVector3();
     material.Flag=io.GetByte();
     material.EdgeColor=io.GetVector4();
     material.EdgeSize=io.GetFloat();
     material.TextureIndex=GetTextureIndex(io);
     material.SphereTextureIndex=GetTextureIndex(io);
     material.SphereMode=(SPHERE_MODE)io.GetByte();
     material.UseSharedToon=io.GetByte()==0 ? false : true;
     material.ToonTextureIndex=GetTextureIndex(io);
     material.Memo=GetText(io);
     material.IndexCount=io.GetInt();
     return material;
 }
开发者ID:ousttrue,项目名称:csmeshio,代码行数:21,代码来源:Pmx.cs

示例4: loadFromPath

        public static Model loadFromPath(string path)
        {
            var io=new ByteReader(File.ReadAllBytes(path));
            // pmx header
            var magic=io.GetAscii(4);
            if(magic!="PMX "){
                throw new PmxException("invalid magic");
            }
            var version=io.GetFloat();
            if(version!=2.0f){
                throw new PmxException("invalid version");
            }
            // flags
            int flags=io.GetByte();
            if(flags!=8){
                throw new PmxException("invalid byte");
            }
            TEXT_ENCODING encoding=(TEXT_ENCODING)io.GetByte();
            byte additional_uv=io.GetByte();
            byte vertex_index_bytes=io.GetByte();
            byte texture_index_bytes=io.GetByte();
            byte material_index_bytes=io.GetByte();
            byte bone_index_bytes=io.GetByte();
            byte morph_index_bytes=io.GetByte();
            byte rigidbody_index_bytes=io.GetByte();

            var loader=new Loader(
                    GetTextFunc(encoding),
                    GetIndexFunc(vertex_index_bytes),
                    GetIndexFunc(texture_index_bytes),
                    GetIndexFunc(bone_index_bytes)
                    );

            return loader.load(io);
        }
开发者ID:ousttrue,项目名称:csmeshio,代码行数:35,代码来源:Pmx.cs


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