private void PrepareAnimation()
        {
            floorPoint   = new Point3D(0, ((TSkeleton[])SKLRecording[0])[0].Position[15].Y, 0);
            myBallModels = new BallModel[1];
            for (int a = 0; a < myBallModels.Length; a++)
            {
                if (a == 0)
                {
                    myBallModels[a] = new BallModel(_models, Colors.Red, Colors.Green);
                }
                else
                {
                    myBallModels[a] = new BallModel(_models, Colors.Orange, Colors.BlueViolet);
                }
            }

            _models.ForEach(x => mainViewport.Children.Add(x));


            ImageBrush colors_brush = new ImageBrush();

            colors_brush.ImageSource =
                new BitmapImage(new Uri("Wall3.png", UriKind.Relative));

            //colors_brush.TileMode = TileMode.Tile;
            //colors_brush.Stretch = Stretch.None;
            DiffuseMaterial colors_material =
                new DiffuseMaterial(colors_brush);

            double eps        = 0.1;
            double roomHeight = 4;
            double roomWidth  = 10;

            //front
            mainViewport.Children.Add(GraphicPrimitiveGenerator.GetTexturedCube(colors_material, new Point3D(floorPoint.X, floorPoint.Y + (roomHeight / 2.0) - eps, floorPoint.Z + (roomWidth / 2.0)), new Size3D(roomWidth, roomHeight, 0.01)));
            //right
            mainViewport.Children.Add(GraphicPrimitiveGenerator.GetTexturedCube(colors_material, new Point3D(floorPoint.X - (roomWidth / 2.0), floorPoint.Y + (roomHeight / 2.0) - eps, floorPoint.Z), new Size3D(0.01, roomHeight, roomWidth)));
            //left
            mainViewport.Children.Add(GraphicPrimitiveGenerator.GetTexturedCube(colors_material, new Point3D(floorPoint.X + (roomWidth / 2.0), floorPoint.Y + (roomHeight / 2.0) - eps, floorPoint.Z), new Size3D(0.01, roomHeight, roomWidth)));
            //rear
            mainViewport.Children.Add(GraphicPrimitiveGenerator.GetTexturedCube(colors_material, new Point3D(floorPoint.X, floorPoint.Y + (roomHeight / 2.0) - eps, floorPoint.Z - (roomWidth / 2.0)), new Size3D(roomWidth, roomHeight, 0.01)));

            colors_brush             = new ImageBrush();
            colors_brush.ImageSource =
                new BitmapImage(new Uri("Floor.png", UriKind.Relative));
            //new BitmapImage(new Uri("Floor3.png", UriKind.Relative));
            colors_material =
                new DiffuseMaterial(colors_brush);

            //ceiling
            ceiling = GraphicPrimitiveGenerator.GetTexturedCube(colors_material, new Point3D(floorPoint.X, floorPoint.Y + roomHeight - eps, floorPoint.Z), new Size3D(roomWidth, 0.01, roomWidth));
            mainViewport.Children.Add(ceiling);
            //floor
            mainViewport.Children.Add(GraphicPrimitiveGenerator.GetTexturedCube(colors_material, new Point3D(floorPoint.X, floorPoint.Y, floorPoint.Z), new Size3D(roomWidth, 0.01, roomWidth)));
            mainViewport.ClipToBounds     = false;
            mainViewport.IsHitTestVisible = false;
        }
示例#2
0
        private void generateHelpJoints(int index1, int index2, int count, Color limbColor)
        {
            ModelVisual3D mv3d = null;

            JointIndex ji = new JointIndex();

            ji.joint1 = index1;
            ji.joint2 = index2;
            for (int b = 0; b < count; b++)
            {
                mv3d = GraphicPrimitiveGenerator.CreateSphere(
                    new Point3D(0, 0, 0), SmallBllSize, 4, 4, limbColor);
                _models.Add(mv3d);
                ji.visuals.Add(mv3d);

                balls.Add(new BallBoundingBox(0, 0, 0, SmallBllSize, index1, index2));
            }
            jointIndexAray.Add(ji);
        }
示例#3
0
        public BallModel(List <ModelVisual3D> allModels, Color jointsColors, Color limbsColors)
        {
            //Main joints
            for (int b = 0; b < 21; b++)
            {
                _models.Add(GraphicPrimitiveGenerator.CreateSphere(
                                new Point3D(0, 0, 0), LargeBallSize, 7, 7, jointsColors));
                balls.Add(new BallBoundingBox(0, 0, 0, LargeBallSize, b, b));
            }
            //hip knee
            generateHelpJoints(16, 17, 9, limbsColors);
            //knee ankle
            generateHelpJoints(17, 18, 9, limbsColors);
            //ankle foot
            generateHelpJoints(18, 19, 3, limbsColors);
            //spine base hip right
            generateHelpJoints(0, 16, 1, limbsColors);

            //hip knee
            generateHelpJoints(13, 12, 9, limbsColors);
            //knee ankle
            generateHelpJoints(13, 14, 9, limbsColors);
            //ankle foot
            generateHelpJoints(14, 15, 3, limbsColors);
            //spine base hip right
            generateHelpJoints(0, 12, 1, limbsColors);


            //base mid
            generateHelpJoints(0, 1, 7, limbsColors);
            //mid shoulder
            generateHelpJoints(1, 20, 5, limbsColors);
            //shoulder neck
            //generateHelpJoints(2, 20, 10);
            //head neck
            generateHelpJoints(2, 3, 3, limbsColors);



            //shoulder shoulder
            generateHelpJoints(20, 8, 5, limbsColors);
            //shoulder elbow
            generateHelpJoints(8, 9, 9, limbsColors);
            //elbow wrist
            generateHelpJoints(9, 10, 9, limbsColors);
            //hand wrist

            /*generateHelpJoints(10, 11, 1);
            *  //thumb
            *  generateHelpJoints(11, 24, 1);
            *  //hand tip
            *  generateHelpJoints(11, 23, 1);*/

            //shoulder shoulder
            generateHelpJoints(20, 4, 5, limbsColors);
            //shoulder elbow
            generateHelpJoints(4, 5, 9, limbsColors);
            //elbow wrist
            generateHelpJoints(5, 6, 9, limbsColors);

            //t3DModels = new Transform3D[_models.Count];
            allModels.AddRange(_models);
        }