public override void Run(RenderControl render)
        {
            // add a plane
            var mMaterial1 = MeshPhongMaterial.Create("phong.texture");

            mMaterial1.SetFaceSide(EnumFaceSide.DoubleSide);
            var texture = ImageTexture2D.Create(GetResourcePath("textures/bricks2.jpg"));

            mMaterial1.SetColorMap(texture);

            var plane     = GeometryBuilder.CreatePlane(500, 500);
            var planeNode = new PrimitiveSceneNode(plane, mMaterial1);

            planeNode.SetTransform(Matrix4.makeTranslation(new Vector3(0, 0, -2.5f)));
            planeNode.SetPickable(false);

            render.ShowSceneNode(planeNode);



            mDevice = new PrimitiveSceneNode(GeometryBuilder.CreateSphere(5), null);
            render.ShowSceneNode(mDevice);

            mCome = new RigidAnimation();
            mCome.Add(new MoveAnimationClip(mDevice, mWorkingPosition, 0, 5));

            mGo = new RigidAnimation();
            mGo.Add(new MoveAnimationClip(mDevice, new Vector3(-200, -200, 0), 0, 5));
        }
示例#2
0
        public override void Run(RenderControl render)
        {
            var material = MeshStandardMaterial.Create("workpiece");

            material.SetColor(new Vector3(0.9f));
            material.SetFaceSide(EnumFaceSide.DoubleSide);

            var shape = ShapeBuilder.MakeCylinder(GP.YOZ(), 5, 50, 0);

            mWorkpiece = BrepSceneNode.Create(shape, material, null);

            render.ShowSceneNode(mWorkpiece);

            var coord     = new GAx2(new GPnt(0, 0, 5), GP.DZ());
            var toolShape = ShapeBuilder.MakeCone(coord, 0, 2, 5, 0);
            var toolNode  = render.ShowShape(toolShape, ColorTable.Blue);


            render.ShowSceneNode(mMotionTrail);


            // Initialize Animation
            mAnimation = new RigidAnimation();

            var rotation = Matrix4.makeRotationAxis(new Vector3(1, 0, 0), (float)Math.PI);
            var trf      = Matrix4.makeTranslation(-50, 0, 0) * rotation;

            mAnimation.Add(new MatrixAnimationClip(mWorkpiece, mWorkpiece.GetTransform(), trf, 0, 10));
            mAnimation.Add(new MatrixAnimationClip(toolNode, toolNode.GetTransform(), trf, 10, 15));
            mAnimation.Add(new RotateAnimationClip(toolNode, Vector3.UNIT_Z, (float)Math.PI * 4, 16, 20));
        }