Esempio n. 1
0
    void executeFrame(JointModel joint = null) {

        if (joint == null) {
            joint = this.joint;
        }
        Transform transformOfTheJoint = joint.getSelfTransform();
        Vector3 newPos = transformOfTheJoint.localPosition;
        Vector3 newRot = transformOfTheJoint.localEulerAngles;

        foreach (ChannelDescriptor channel in joint.getIteratorChannels()) {

            ChannelDescriptor.CHANNEL_TYPE channelType = channel.ChannelType;
            float frameDatum = channel.popFrameData();  


            switch (channelType) {

                case ChannelDescriptor.CHANNEL_TYPE.X_POSITION:
                    newPos.x = +frameDatum;
                    break;

                case ChannelDescriptor.CHANNEL_TYPE.Y_POSITION:
                    newPos.y += frameDatum;
                    break;

                case ChannelDescriptor.CHANNEL_TYPE.Z_POSITION:
                    newPos.z += frameDatum;
                    break;

                case ChannelDescriptor.CHANNEL_TYPE.X_ROTATION:
                    newRot.x = +frameDatum;
                    break;

                case ChannelDescriptor.CHANNEL_TYPE.Y_ROTATION:
                    newRot.y += frameDatum;
                    break;

                case ChannelDescriptor.CHANNEL_TYPE.Z_ROTATION:
                    newRot.z += frameDatum;
                    break;

            }
        
        }

        if (newPos != transformOfTheJoint.localPosition) {
            transformOfTheJoint.position = newPos;
        }

        if (newRot != transformOfTheJoint.localEulerAngles) {
            transformOfTheJoint.localEulerAngles = newRot;
        }

        foreach (JointModel child in joint.getIteratorChildJoints())
        {
            executeFrame(child);
        }

    }
Esempio n. 2
0
        public bool PostSong(JointModel joint)
        {
            JointPlaylist addSong = new JointPlaylist();

            addSong.PlaylistId = joint.PlaylistId;
            addSong.SongId     = joint.SongId;

            using (var context = new ApplicationDbContext())
            {
                context.JointPlaylists.Add(addSong);
                context.SaveChanges();
                var id = context.Playlists.Single(e => e.PlaylistId == joint.PlaylistId);
                id.TotalTimeOfPlaylist = GetPlaylistTime(GetPlaylistSongs(joint.SongId));
                return(context.SaveChanges() == 1);
            };
        }
Esempio n. 3
0
    void parseTest1()
    {
        TextAsset rawBvhFile = Resources.Load("ex2") as TextAsset;

        BParser.RawParseResult rawParseResult = BParser.parse(rawBvhFile.text);
        RawJoint rawJoint = rawParseResult.RawJoint;


        List <ChannelDescriptor> channelsExtracted = new List <ChannelDescriptor>(0);

        JointModel refinedJoint = BParser.refineRawJointDataIntoJoints(rawJoint, ref channelsExtracted);

        //This statement below should technically update all the channel descriptors
        BParser.assigningFrameDataToChannelDescriptors(new Queue <float>(rawParseResult.FrameData), channelsExtracted);
        Debug.Log("The name of the joint:");
    }
Esempio n. 4
0
        public IHttpActionResult PostSong(JointModel playlist)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = SongPlaylistService();

            if (!service.PostSong(playlist))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Esempio n. 5
0
    void parseDataAndInitialize()
    {

        TextAsset rawBvhFile = Resources.Load("jog") as TextAsset;

        BParser.RawParseResult rawParseResult = BParser.parse(rawBvhFile.text);
        RawJoint rawJoint = rawParseResult.RawJoint;

        fps = (int)(1 / rawParseResult.FrameTime);
        numOfFrames = rawParseResult.NumFrames;

        List<ChannelDescriptor> channelsExtracted = new List<ChannelDescriptor>(0);

        joint = BParser.refineRawJointDataIntoJoints(rawJoint, ref channelsExtracted);
        
        //This statement below should technically update all the channel descriptors 
        
        BParser.assigningFrameDataToChannelDescriptors(new Queue<float>(rawParseResult.FrameData), channelsExtracted);
        
        
    }
Esempio n. 6
0
 public void addJoint(JointModel joint)
 {
     childrenJoints.Add(joint);
 }
Esempio n. 7
0
 public void AddChild(JointModel joint)
 {
     childrenJoints.Add(joint);
 }
Esempio n. 8
0
    void findTransformAndAssignToJointWithOffsetAdjustments(JointModel joint, JointModel parentJoint = null) {

        switch (joint.name) {

            case TXT_JOINTS.Hips:
                joint.setSelfTransform(Hips);
                break;

            case TXT_JOINTS.LeftHip:
                joint.setSelfTransform(LeftHip);
                break;

            case TXT_JOINTS.RightHip:
                joint.setSelfTransform(RightHip);
                break;

            case TXT_JOINTS.LeftKnee:

                joint.setSelfTransform(LeftKnee);
                break;

            case TXT_JOINTS.RightKnee:
                joint.setSelfTransform(RightKnee);
                break;

            case TXT_JOINTS.LeftAnkle:
                joint.setSelfTransform(LeftAnkle);
                break;

            case TXT_JOINTS.RightAnkle:
                joint.setSelfTransform(RightAnkle);
                break;

            case TXT_JOINTS.Chest:
                joint.setSelfTransform(Chest);
                break;

            case TXT_JOINTS.Neck:
                joint.setSelfTransform(Neck);
                break;

            case TXT_JOINTS.Head:
                joint.setSelfTransform(Head);
                break;

            case TXT_JOINTS.LeftCollar:
                joint.setSelfTransform(LeftCollar);
                break;

            case TXT_JOINTS.RightCollar:
                joint.setSelfTransform(RightCollar);
                break;

            case TXT_JOINTS.LeftShoulder:
                joint.setSelfTransform(LeftShoulder);
                break;

            case TXT_JOINTS.RightShoulder:
                joint.setSelfTransform(RightShoulder);
                break;

            case TXT_JOINTS.RightElbow:
                joint.setSelfTransform(RightElbow);
                break;

            case TXT_JOINTS.LeftElbow:
                joint.setSelfTransform(LeftElbow);
                break;

            case TXT_JOINTS.RightWrist:
                joint.setSelfTransform(RightWrist);
                break;

            case TXT_JOINTS.LeftWrist:
                joint.setSelfTransform(LeftWrist);
                break;
            
        }
            
        //set offset
        if (parentJoint != null) {
            joint.setPosRelativeToTheParent(parentJoint.getSelfTransform().localPosition);
        }

        foreach (JointModel child in joint.getIteratorChildJoints())
        {
            findTransformAndAssignToJointWithOffsetAdjustments(child,joint);
        }
    
    }