nuclear@0: #include "motion.h" nuclear@0: nuclear@0: MotionController::MotionController() { nuclear@0: memset(this, 0, sizeof(MotionController)); nuclear@0: } nuclear@0: nuclear@0: void MotionController::SetTranslation(float (*xtrans)(float), float (*ytrans)(float), float (*ztrans)(float), float ScaleInput) { nuclear@0: XTranslation = xtrans; nuclear@0: YTranslation = ytrans; nuclear@0: ZTranslation = ytrans; nuclear@0: ScaleInputTrans = ScaleInput; nuclear@0: } nuclear@0: nuclear@0: void MotionController::SetRotation(float (*xrot)(float), float (*yrot)(float), float (*zrot)(float), float ScaleInput) { nuclear@0: XRotation = xrot; nuclear@0: YRotation = yrot; nuclear@0: ZRotation = zrot; nuclear@0: ScaleInputRot = ScaleInput; nuclear@0: } nuclear@0: nuclear@0: void MotionController::SetScaling(float (*xscale)(float), float (*yscale)(float), float (*zscale)(float), float ScaleInput) { nuclear@0: XScaling = xscale; nuclear@0: YScaling = yscale; nuclear@0: ZScaling = zscale; nuclear@0: ScaleInputScale = ScaleInput; nuclear@0: } nuclear@0: nuclear@0: void MotionController::SetPath(const Curve &path) { nuclear@0: FollowPath = true; nuclear@0: // TODO nuclear@0: } nuclear@0: nuclear@0: const Matrix4x4 &MotionController::GetTransformation(float t) { nuclear@0: MotionXForm.ResetIdentity(); nuclear@0: nuclear@0: if(FollowPath) { nuclear@0: // TODO nuclear@0: } else { nuclear@0: float tt = t * ScaleInputTrans; nuclear@0: float tr = t * ScaleInputRot; nuclear@0: float ts = t * ScaleInputScale; nuclear@0: MotionXForm.Scale(XScaling ? XScaling(tt) : 0, YScaling ? YScaling(tt) : 0, ZScaling ? ZScaling(tt) : 0); nuclear@0: MotionXForm.Rotate(XRotation ? XRotation(tr) : 0, YRotation ? YRotation(tr) : 0, ZRotation ? ZRotation(tr) : 0); nuclear@0: MotionXForm.Translate(XTranslation ? XTranslation(ts) : 0, YTranslation ? YTranslation(ts) : 0, ZTranslation ? ZTranslation(ts) : 0); nuclear@0: } nuclear@0: nuclear@0: return MotionXForm; nuclear@0: } nuclear@0: nuclear@0: