public override void Animation(RenderControl render, float time) { mTheta += 0.5f; mRobot.SetVariable(1, mTheta * 2); mRobot.SetVariable(2, mTheta * 3); mRobot.SetVariable(3, mTheta * 2); mRobot.SetVariable(4, mTheta * 2); mRobot.SetVariable(5, mTheta * 1); mRobot.SetVariable(6, mTheta * 1); if (mD > 30 || mD < 10) { mSign *= -1; } mD += mSign * 0.2f; mRobot.UpdateFrames(); Vector3 pt = new Vector3(0); pt = pt * mRobot.GetFinalTransform(); mMotionTrail.SetPosition(mCount, pt); mMotionTrail.UpdateBoundingBox(); ++mCount; render.RequestDraw(EnumUpdateFlags.Scene); }
public override void Animation(RenderControl render, float time) { if (mRobotAnimation.Play(time)) { Vector3 pt = new Vector3(0); pt = pt * mRobot.GetFinalTransform(); mMotionTrail.SetPosition(mCount, pt); mMotionTrail.UpdateBoundingBox(); ++mCount; //Blink blink effect BrepSceneNode.Cast(mRobot.GetLink((mCount - 1) % 7).GetVisualNode()).GetShape().SetFaceMaterial(mRobotMaterial); BrepSceneNode.Cast(mRobot.GetLink(mCount % 7).GetVisualNode()).GetShape().SetFaceMaterial(mMaterial); render.RequestDraw(EnumUpdateFlags.Scene); } }
public override void Run(RenderControl render) { var fileName = GetResourcePath("models/YONGSHENGDA_9998.igs"); var shape = ShapeIO.Open(fileName); if (shape == null) { return; } var face = shape.FindChild(EnumTopoShapeType.Topo_FACE, 12); var edges = face.GetChildren(EnumTopoShapeType.Topo_EDGE); var wire = SketchBuilder.MakeWire(edges); if (wire == null) { return; } var curve = new ParametricCurve(); curve.Initialize(wire); var ulist = curve.SplitByUniformLength(1, 0.2); var node = new ParticleSceneNode((uint)ulist.Count, ColorTable.Red, 2); for (int ii = 0; ii < ulist.Count; ++ii) { node.SetPosition((uint)ii, Vector3.From(curve.Value(ulist[ii]))); } node.UpdateBoundingBox(); render.ShowShape(wire, ColorTable.GoldEnrod); render.ShowSceneNode(node); }
public override void Animation(RenderControl render, float time) { if (this.State == 0) { return; } mTheta += 0.5f; mRobot.SetVariable(1, mTheta * 1); mRobot.SetVariable(2, mTheta * 2); mRobot.SetVariable(4, mTheta * 3); mRobot.SetVariable(6, mTheta * 4); mRobot.SetVariable(7, mTheta * 5); mRobot.SetVariable(8, mTheta * 6); if (mD > 30 || mD < 10) { mSign *= -1; } mD += mSign * 0.2f; mRobot.UpdateFrames(); Vector3 pt = new Vector3(0); pt = pt * mRobot.GetFinalTransform(); mMotionTrail.SetPosition(mCount, pt); mMotionTrail.UpdateBoundingBox(); ++mCount; if (this.State == 1) { var position = pt - Vector3.UNIT_Y * 500; render.GetCamera().LookAt(position, pt, Vector3.UNIT_Z); } else if (this.State == 2) { var position = pt + Vector3.UNIT_Z * 500; render.GetCamera().LookAt(position, pt, Vector3.UNIT_Y); } else if (this.State == 3) { var camera = render.GetCamera(); var postion = new Vector3(0, -500, 0); var trf = Matrix4.makeRotationAxis(Vector3.UNIT_Z, mTheta * 3.1415926f / 180); postion.applyMatrix4(trf); camera.LookAt(postion, Vector3.Zero, Vector3.UNIT_Z); } if (this.State == 1 && mTheta > 360) { this.State = 2; } else if (this.State == 2 && mTheta > 720) { render.SetStandardView(EnumStandardView.Front); this.State = 3; } render.RequestDraw(EnumUpdateFlags.Scene); }