ReadBVH

这段代码展示了如何使用C#读取并解析BVH(Biovision Hierarchy)文件,这是一种用于表示三维骨骼动画的数据格式。程序定义了一个Joint类来存储关节信息,包括名称、类型、偏移值、通道和子关节。Main方法中,通过StreamReader逐行读取文件内容,遇到'ROOT'或'JOINT'标签时,调用ReadAndCreate递归创建关节树。当遇到'END'标签时,标记当前关节为末端关节,并读取结束偏移值。
摘要由CSDN通过智能技术生成

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;

namespace ReadBVH
{
    class Joint
    {
        public string name;
        public string type;
        public string[] offset;
        public string[] channels;
        public bool isEnd;
        public string[] endOffset;
        public ArrayList child = new ArrayList();
    }

    class Program
    {
        static StreamReader sr;

        static void ReadAndCreate(Joint root,string name)
        {
            Joint currentJoint = new Joint();
            currentJoint.name = name;
            sr.ReadLine();
            currentJoint.offset = sr.ReadLine().Trim().Split();
            currentJoint.channels = sr.ReadLine().Trim().Split();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值