public virtual void applyBap(AnimationParametersFrame bf) { if (needsUpdate(bf)) { bone.localRotation = postRotation * getRotation(bf) * preRotation; } }
public override void concatenate(AnimationParametersFrame original, AnimationParametersFrame result) { int[] addition = new int[3]; JointType joint = to; while (joint != from) { add(addition, original, joint); joint = joint.parent; } add(addition, original, from); if (to.rotationX != BAPType.null_bap) { result.applyValue(to.rotationX, addition[0]); } if (to.rotationY != BAPType.null_bap) { result.applyValue(to.rotationY, addition[1]); } if (to.rotationZ != BAPType.null_bap) { result.applyValue(to.rotationZ, addition[2]); } }
public APExternalClient(int numberOfAP_, string host, int port) : base(host, port) { numberOfAP = numberOfAP_; timer = new TimeController(); lastFrame = new AnimationParametersFrame(numberOfAP, 0); apFramesList = new APFramesList(lastFrame); }
public override bool needsUpdate(AnimationParametersFrame bf) { bool update = base.needsUpdate(bf); twist.twistUpdate = update; return(update); }
public override void applyFap(AnimationParametersFrame ff) { faceBone.localPosition = new Vector3( position.x + dir.x * ff.getValue(type1) + dir2.x * ff.getValue(type2), position.y + dir.y * ff.getValue(type1) + dir2.y * ff.getValue(type2), position.z + dir.z * ff.getValue(type1) + dir2.z * ff.getValue(type2)); }
public override Quaternion getRotation(AnimationParametersFrame bf) { Quaternion original = base.getRotation(bf); twist.twistRotation = getTwistRotation(original); return(propagateTwist(twist.twistRotation, original)); }
public void applyFapFrame(AnimationParametersFrame fapframe) { foreach (autodeskcharacter.fapmapper.FapMapper mapper in fapMappers) { mapper.applyFap(fapframe); } }
// Use this for initialization void Awake() { InitCharacterMesh(); changeTPoseToNPose(); setUpSkeleton(); // from old code Time.fixedDeltaTime = (float)0.04; characterTimer = new TimeController(); characterTimer.setTimeMillis(0); bapReceiver = new BAPReceiver(NUMBER_OF_BAPS, BAP_RECEIVER_PORT); fapReceiver = new FAPReceiver(NUMBER_OF_FAPS + 1, FAP_RECEIVER_PORT); audioReceiver = new AudioReceiver(AUDIO_RECEIVER_PORT); lastFAPFrame = new AnimationParametersFrame(NUMBER_OF_FAPS + 1, 0); lastBAPFrame = new AnimationParametersFrame(NUMBER_OF_BAPS, 0); cptFrames = 0; commandSender = new CommandSender(GretaServersHost, CMD_SENDER_PORT); agentPlaying = false; _currentAudioSource = getBone("Head").gameObject.AddComponent <AudioSource>(); audioFilePlayer = new AudioFilePlayer(); }
public override void applyFap(AnimationParametersFrame ff) { if (ff.getMask(axis1Type) || ff.getMask(axis2Type) || ff.getMask(stretchType)) { faceBone.localPosition = new Vector3( position.x + direction1.x * ff.getValue(axis1Type) + direction2.x * ff.getValue(axis2Type) + stretchDirection.x * ff.getValue(stretchType), position.y + direction1.y * ff.getValue(axis1Type) + direction2.y * ff.getValue(axis2Type) + stretchDirection.y * ff.getValue(stretchType), position.z + direction1.z * ff.getValue(axis1Type) + direction2.z * ff.getValue(axis2Type) + stretchDirection.z * ff.getValue(stretchType)); } if (ff.getMask(innerType)) { float dist = ff.getValue(innerType); Quaternion q = Quaternion.AngleAxis(dist * magicNumber, rotationAxis); faceBone.localRotation = q * orientinitial; } }
public override void applyFap(AnimationParametersFrame ff) { if (ff.getMask(type) || ff.getMask(type2)) { float fapvaltouse = 0; if (ff.getMask(type)) { if (ff.getMask(type2)) { fapvaltouse = Mathf.Max(ff.getValue(type), ff.getValue(type2)); } else { fapvaltouse = ff.getValue(type); } } else { ff.getValue(type2); } faceBone.localScale = new Vector3( 1 + dir.x * fapvaltouse, 1 + dir.y * fapvaltouse, 1 + dir.z * fapvaltouse); } }
public override Quaternion getRotation(AnimationParametersFrame bf) { Quaternion q1 = newQuaternion(axis1, lastVal1); Quaternion q2 = newQuaternion(axis2, lastVal2); return(q2 * q1); }
public void applyBapFrame(AnimationParametersFrame bapframe) { bapframe = concatenator.concatenateJoints(bapframe); foreach (autodeskcharacter.bapmapper.BapMapper mapper in bapMappers) { mapper.applyBap(bapframe); } }
public override Quaternion getRotation(AnimationParametersFrame bf) { Quaternion q1 = newQuaternion(axis1, (lastVal1 * scale)); Quaternion q2 = newQuaternion(axis2, (lastVal2 * scale)); Quaternion q3 = newQuaternion(axis3, (lastVal3 * scale)); return(q3 * q2 * q1); }
protected static Quaternion getJointRotation(AnimationParametersFrame frame, JointType joint) { Quaternion q = fromXYZ( joint.rotationX == BAPType.null_bap ? 0 : (float)frame.getRadianValue(joint.rotationX), joint.rotationY == BAPType.null_bap ? 0 : (float)frame.getRadianValue(joint.rotationY), joint.rotationZ == BAPType.null_bap ? 0 : (float)frame.getRadianValue(joint.rotationZ)); return(q); }
public AnimationParametersFrame concatenateJoints(AnimationParametersFrame frame) { AnimationParametersFrame result = new AnimationParametersFrame(frame.APVector.Count, frame.getFrameNumber()); foreach (Concatenator c in concatenators) { c.concatenate(frame, result); } return(result); }
private void copy(AnimationParametersFrame original, AnimationParametersFrame result, BAPType bapType) { if (bapType != BAPType.null_bap) { if (original.getMask(bapType)) { result.applyValue(bapType, original.getValue(bapType)); } } }
protected static Quaternion computeChain(AnimationParametersFrame frame, JointType jointFrom, JointType jointTo) { Quaternion qTo = getJointRotation(frame, jointTo); if (jointFrom == jointTo) { return(qTo); } return(computeChain(frame, jointFrom, jointTo.parent) * qTo); }
public override bool needsUpdate(AnimationParametersFrame bf) { bool toReturn = base.needsUpdate(bf); if (bf.getMask(type3)) { lastVal3 = bf.getRadianValue(type3); toReturn = true; } return(toReturn); }
// Update is called once per frame void Update() { if (apReceiver.timer.isSynchronized()) { AnimationParametersFrame currentAPFrame = apReceiver.getCurrentFrame(apReceiver.timer.getTimeMillis() / 40); if (currentAPFrame != null) { Debug.Log(apReceiver.timer.getTimeMillis() / 40 + " " + currentAPFrame.AnimationParametersFrame2String()); } } }
public AnimationParametersFrame getCurrentFrame(long currentTime) { //Debug.Log ("current frame: "+ apFramesList.getCurrentFrame(currentTime)); AnimationParametersFrame currentAPFrame = apFramesList.getCurrentFrame(currentTime); /*if(lastFrame.isEqualTo(currentAPFrame)){ * return null; * } else { * lastFrame = currentAPFrame;*/ return(currentAPFrame); //} }
public override void applyFap(AnimationParametersFrame ff) { if (ff.getMask(pitch) || ff.getMask(yaw)) { Quaternion qx = Quaternion.AngleAxis( ff.getValue(pitch) * amplitude1, pitchAxis); Quaternion qy = Quaternion.AngleAxis( ff.getValue(yaw) * amplitude2, yawAxis); faceBone.localRotation = qy * qx * orientInitial; } }
private void add(int[] addition, AnimationParametersFrame frame, JointType joint) { if (joint.rotationX != BAPType.null_bap && frame.getMask(joint.rotationX)) { addition[0] = addition[0] + frame.getValue(joint.rotationX); } if (joint.rotationY != BAPType.null_bap && frame.getMask(joint.rotationY)) { addition[1] = addition[1] + frame.getValue(joint.rotationY); } if (joint.rotationZ != BAPType.null_bap && frame.getMask(joint.rotationZ)) { addition[2] = addition[2] + frame.getValue(joint.rotationZ); } }
public override bool needsUpdate(AnimationParametersFrame bf) { bool toReturn = false; if (bf.getMask(type1)) { lastVal1 = bf.getRadianValue(type1); toReturn = true; } if (bf.getMask(type2)) { lastVal2 = bf.getRadianValue(type2); toReturn = true; } return(toReturn); }
public override void concatenate(AnimationParametersFrame original, AnimationParametersFrame result) { Vector3 xyz = toEulerXYZ(computeChain(original, from, to)); if (from.rotationX != BAPType.null_bap) { result.setRadianValue(from.rotationX, xyz.x); } if (from.rotationY != BAPType.null_bap) { result.setRadianValue(from.rotationY, xyz.y); } if (from.rotationZ != BAPType.null_bap) { result.setRadianValue(from.rotationZ, xyz.z); } }
public List <AnimationParametersFrame> thriftAPFrameList2gretaAPFrameList(List <ThriftAnimParamFrame> thriftAPframes) { List <AnimationParametersFrame> gretaAPFrameList = new List <AnimationParametersFrame>(thriftAPframes.Count); foreach (ThriftAnimParamFrame thriftFrame in thriftAPframes) { AnimationParametersFrame gretaFrame = new AnimationParametersFrame(numberOfAP, (long)thriftFrame.FrameNumber); List <ThriftAnimParam> thriftAPList = thriftFrame.AnimParamList; int i = 0; foreach (ThriftAnimParam thriftAP in thriftAPList) { gretaFrame.setAnimationParameter(i, thriftAP.Value, thriftAP.Mask); ++i; } gretaAPFrameList.Add(gretaFrame); } return(gretaAPFrameList); }
public APFilePlayer(int numOfAP) { numberOfAP = numOfAP; lastFrame = new AnimationParametersFrame(numberOfAP, 0); apFramesList = new APFramesList(lastFrame); }
public override Quaternion getRotation(AnimationParametersFrame bf) { return(newQuaternion(axis1, bf.getRadianValue(type1))); }
public override bool needsUpdate(AnimationParametersFrame bf) { return(bf.getMask(type1)); }
public virtual Quaternion getRotation(AnimationParametersFrame bf) { return(Quaternion.identity); }
public virtual bool needsUpdate(AnimationParametersFrame bf) { return(false); }