예제 #1
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            try
            {
                tgcKinect = new TgcKinect();
                tgcKinect.init();
                tgcKinect.DebugSkeleton.init();
            }
            catch (Exception)
            {
                GuiController.Instance.Logger.logError("No se detecto KINECT");
            }



            text          = new TgcText2d();
            text.Position = new Point(30, 30);
            text.Color    = Color.Red;
            text.changeFont(new System.Drawing.Font(FontFamily.GenericMonospace, 36, FontStyle.Bold));
            text.Text = "Nada";
            text.Size = new Size(300, 100);


            gestoDetectado = false;
            acumTime       = 0;
            showAcumTime   = 0;

            GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(10.2881f, 1f, 9.6917f), new Vector3(10.2427f, 1.0175f, 10.6906f));

            GuiController.Instance.Modifiers.addFloat("diff", -1f, -0.1f, -0.37f);
        }
예제 #2
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Iniciar kinect
            tgcKinect = new TgcKinect();
            tgcKinect.init();
            tgcKinect.DebugSkeleton.init();

            //Analizador de gestos
            gestureAnalizer = new GestureAnalizer();
            sceneBounds     = new TgcBoundingBox(new Vector3(-10, 0, -10), new Vector3(10, 20, 10));
            gestureAnalizer.setSceneBounds(sceneBounds);

            //Crear mueble de fondo
            mueble          = TgcBox.fromSize(new Vector3(20, 20, 5), Color.SandyBrown);
            mueble.Position = new Vector3(0, 10, -10);

            //Crear algunos cajones
            Vector3 muebleCenterPos = mueble.Position;

            cajones = new List <GestureLocker>();
            cajones.Add(crearCajon(muebleCenterPos + new Vector3(-3, 0, 0.25f), new Vector3(5, 2, 5)));
            cajones.Add(crearCajon(muebleCenterPos + new Vector3(0, 3, 0.25f), new Vector3(5, 2, 5)));
            cajones.Add(crearCajon(muebleCenterPos + new Vector3(3, 0, 0.25f), new Vector3(5, 2, 5)));


            GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(-3.5508f, 16.5873f, 13.2958f), new Vector3(-3.535f, 16.3069f, 12.336f));

            center = TgcBox.fromSize(new Vector3(0, 0, 0), new Vector3(1, 1, 1), Color.Blue);
        }
예제 #3
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Iniciar kinect
            tgcKinect = new TgcKinect();
            tgcKinect.init();
            tgcKinect.DebugSkeleton.init();

            //Analizador de gestos
            gestureAnalizer = new GestureAnalizer();
            sceneBounds     = new TgcBoundingBox(new Vector3(-50, -40, 230), new Vector3(80, 50, 290));
            gestureAnalizer.setSceneBounds(sceneBounds);
            sceneCenter = sceneBounds.calculateBoxCenter();

            sceneCenterBox = TgcBox.fromSize(sceneCenter, new Vector3(30, 30, 30), Color.Blue);

            //Crear mueble de fondo
            mueble          = TgcBox.fromSize(new Vector3(200, 100, 50), Color.SandyBrown);
            mueble.Position = new Vector3(20, 20, 200);

            //Crear puerta
            door               = new GestureDoorLeft();
            door.Mesh          = TgcBox.fromSize(new Vector3(30, 40, 4), Color.Green).toMesh("door");
            door.Mesh.Position = mueble.Position + new Vector3(-30, 20, 25);


            GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(1.5467f, 54.7247f, 401.1074f), new Vector3(1.4672f, 54.4561f, 400.1474f));
        }
예제 #4
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;


            tgcKinect = new TgcKinect();
            tgcKinect.init();
            tgcKinect.DebugSkeleton.init();


            GuiController.Instance.FpsCamera.Enable = true;


            GuiController.Instance.UserVars.addVar("tracking", "false");


            center = TgcBox.fromSize(new Vector3(0, 0, 0), new Vector3(1, 1, 1), Color.Blue);
            bounds = new TgcBoundingBox(new Vector3(-10, 0, -10), new Vector3(10, 20, 10));
        }
예제 #5
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Iniciar Kinect
            try
            {
                tgcKinect = new TgcKinect();
                tgcKinect.init();
                tgcKinect.DebugSkeleton.init();
            }
            catch (Exception)
            {
                GuiController.Instance.Logger.logError("Kinect not found");
            }



            GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(-9.1315f, 22.5574f, -41.5821f), new Vector3(-8.9167f, 22.2222f, -40.6648f));


            //Centro y tamaño de escena
            center = TgcBox.fromSize(new Vector3(0, 0, 0), new Vector3(1, 1, 1), Color.Blue);
            bounds = new TgcBoundingBox(new Vector3(-10, 0, -10), new Vector3(10, 20, 10));

            //Imagenes para puntero del mouse
            leftHandPointer          = new TgcSprite();
            leftHandPointer.Texture  = TgcTexture.createTexture(GuiController.Instance.ExamplesMediaDir + "left_pointer.png");
            rightHandPointer         = new TgcSprite();
            rightHandPointer.Texture = TgcTexture.createTexture(GuiController.Instance.ExamplesMediaDir + "right_pointer.png");

            GuiController.Instance.Modifiers.addFloat("speedX", 0.5f, 10f, 1f);
            GuiController.Instance.Modifiers.addFloat("speedY", 0.5f, 10f, 1f);
            GuiController.Instance.Modifiers.addBoolean("showValues", "showValues", false);
        }
예제 #6
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Loader de kinect
            tgcKinect = new TgcKinect();
            tgcKinect.init();
            tgcKinect.DebugSkeleton.init();


            //Loader de focus
            FocusParser.TEXTURE_FOLDER = GuiController.Instance.ExamplesMediaDir + "Focus\\texturas\\";
            FocusParser.MESH_FOLDER    = GuiController.Instance.ExamplesMediaDir + "Focus\\texturas\\";
            FocusParser loader    = new FocusParser();
            string      fileScene = GuiController.Instance.ExamplesMediaDir + "Focus\\escena1.dat";

            loader.FromFile(fileScene);
            _meshes    = loader.Escene;
            _conjuntos = loader._focusSets;

            // Bounding box de la escena
            // Calculo el bounding box de la escena
            float x0 = 10000;
            float y0 = 10000;
            float z0 = 10000;
            float x1 = -10000;
            float y1 = -10000;
            float z1 = -10000;

            foreach (TgcMesh m in _meshes)
            {
                TgcBoundingBox box = m.BoundingBox;
                if (box.PMin.X < x0)
                {
                    x0 = box.PMin.X;
                }
                if (box.PMin.Y < y0)
                {
                    y0 = box.PMin.Y;
                }
                if (box.PMin.Z < z0)
                {
                    z0 = box.PMin.Z;
                }

                if (box.PMax.X > x1)
                {
                    x1 = box.PMax.X;
                }
                if (box.PMax.Y > y1)
                {
                    y1 = box.PMax.Y;
                }
                if (box.PMax.Z > z1)
                {
                    z1 = box.PMax.Z;
                }
            }

            bounds = new TgcBoundingBox(new Vector3(x0, y0, z0), new Vector3(x1, y1, z1));
            Vector3 c = bounds.calculateBoxCenter();

            c.Y    = 0;
            center = TgcBox.fromSize(c, new Vector3(100, 100, 100), Color.Blue);


            //Escalas y centro de la escena para kinect
            tgcKinect.PositionScale   = 1000;
            tgcKinect.sceneCenter     = c;
            tgcKinect.skeletonOffsetY = 0.75f;


            //Analizador de gestos
            gestureAnalizer = new GestureAnalizer();
            gestureAnalizer.setSceneBounds(bounds);



            //Camara
            GuiController.Instance.FpsCamera.Enable         = true;
            GuiController.Instance.FpsCamera.MovementSpeed *= 10;
            GuiController.Instance.FpsCamera.JumpSpeed     *= 10;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(2000f, 1600f, -4000f), new Vector3(2000f, 500f, 0));
            //GuiController.Instance.FpsCamera.setCamera(c, c + new Vector3(0, 0, 1));



            //Separar cajones del resto del FocusSet
            cajones = new List <CajonFocus>();
            foreach (FocusSet conjunto in _conjuntos)
            {
                if (conjunto.Tipo == FocusSet.TRASLACION)
                {
                    CajonFocus cajon = new CajonFocus();
                    cajon.Conjunto = conjunto;
                    cajon.init();
                    cajones.Add(cajon);
                }
            }
        }
예제 #7
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Cargar mesh
            TgcSkeletalLoader loader = new TgcSkeletalLoader();

            loader.MeshFactory = new TgcKinectSkeletalMesh.MeshFactory();
            mesh = (TgcKinectSkeletalMesh)loader.loadMeshFromFile(GuiController.Instance.ExamplesMediaDir + "ModelosTgc\\BasicHuman\\BasicHuman-TgcSkeletalMesh.xml");

            //Hacer mapping de huesos

            /*
             * <bone id='0' name='Bip01' parentId='-1' pos='[0.212447,26.2833,1.14834]' rotQuat='[0.0,0.707106,0.0,0.707107]'/>
             *          <bone id='1' name='Bip01 Pelvis' parentId='0' pos='[0,0,0]' rotQuat='[0.483492,0.475215,0.52165,0.517965]'/>
             *          <bone id='2' name='Bip01 Spine' parentId='1' pos='[2.73985,-0.0318408,-0.0188154]' rotQuat='[0.0404528,0.00189839,-0.00599698,0.999162]'/>
             *          <bone id='3' name='Bip01 Spine1' parentId='2' pos='[6.19498,0,-0.00343716]' rotQuat='[0.0,0.0,0.0,1.0]'/>
             *          <bone id='4' name='Bip01 Neck' parentId='3' pos='[6.41617,0.0869015,-0.0035038]' rotQuat='[0.0,0.0,0.0,1.0]'/>
             *          <bone id='5' name='Bip01 Head' parentId='4' pos='[2.30035,0,0]' rotQuat='[0.0,0.000398831,0.0,1.0]'/>
             *          <bone id='6' name='Bip01 L Clavicle' parentId='4' pos='[-2.09962,0.747039,0.0035013]' rotQuat='[-0.707107,-0.707107,0.000282522,0.00028056]'/>
             *          <bone id='7' name='Bip01 L UpperArm' parentId='6' pos='[4.14776,0,0]' rotQuat='[-0.0074924,-0.063934,-0.0389218,0.997167]'/>
             *          <bone id='8' name='Bip01 L Forearm' parentId='7' pos='[9.01669,0,0]' rotQuat='[0.0,0.0946719,0.0,0.995508]'/>
             *          <bone id='9' name='Bip01 L Hand' parentId='8' pos='[8.40198,0,0]' rotQuat='[0.706825,0.0,0.0,0.707388]'/>
             *          <bone id='10' name='Bip01 R Clavicle' parentId='4' pos='[-2.09962,-0.920842,0.00350595]' rotQuat='[0.707107,-0.707107,-0.00028056,0.000282522]'/>
             *          <bone id='11' name='Bip01 R UpperArm' parentId='10' pos='[4.14776,0,0]' rotQuat='[0.00584129,-0.058849,0.0143832,0.998146]'/>
             *          <bone id='12' name='Bip01 R Forearm' parentId='11' pos='[8.50615,0,0]' rotQuat='[0.0,0.085631,0.0,0.996327]'/>
             *          <bone id='13' name='Bip01 R Hand' parentId='12' pos='[8.54264,0,0]' rotQuat='[-0.706825,0.0,0.0,0.707388]'/>
             *          <bone id='14' name='Bip01 L Thigh' parentId='1' pos='[0,3.89689,0]' rotQuat='[-0.0413224,0.0440018,-0.997924,-0.0224664]'/>
             *          <bone id='15' name='Bip01 L Calf' parentId='14' pos='[11.9134,0,0]' rotQuat='[0.0,0.0998335,0.0,0.995004]'/>
             *          <bone id='16' name='Bip01 L Foot' parentId='15' pos='[11.9134,0,0]' rotQuat='[0.00158055,-0.0615842,0.0182989,0.997933]'/>
             *          <bone id='17' name='Bip01 L Toe0' parentId='16' pos='[2.74009,0,3.52638]' rotQuat='[0.0,-0.707107,0.0,0.707107]'/>
             *          <bone id='18' name='Bip01 R Thigh' parentId='1' pos='[0,-3.89689,0]' rotQuat='[-0.0261322,0.0341116,-0.998212,0.04156]'/>
             *          <bone id='19' name='Bip01 R Calf' parentId='18' pos='[11.9134,0,0]' rotQuat='[0.0,0.0998335,0.0,0.995004]'/>
             *          <bone id='20' name='Bip01 R Foot' parentId='19' pos='[11.9134,0,0]' rotQuat='[-0.00187365,-0.0741152,-0.046938,0.996143]'/>
             *          <bone id='21' name='Bip01 R Toe0' parentId='20' pos='[2.74009,0,3.52638]' rotQuat='[0.0,-0.707107,0.0,0.707107]'/>
             */
            //http://www.codeproject.com/KB/dotnet/KinectGettingStarted/7.png
            List <TgcKinectSkeletalMesh.Mapping> mapping = new List <TgcKinectSkeletalMesh.Mapping>();

            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01", JointType.HipCenter));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 Pelvis", JointType.HipCenter));      //????
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 Spine", JointType.Spine));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 Spine1", JointType.ShoulderCenter)); //????
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 Neck", JointType.ShoulderCenter));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 Head", JointType.Head));

            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L Clavicle", JointType.ShoulderLeft));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L UpperArm", JointType.ElbowLeft));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L Forearm", JointType.WristLeft));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L Hand", JointType.HandLeft));

            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R Clavicle", JointType.ShoulderRight));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R UpperArm", JointType.ElbowRight));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R Forearm", JointType.WristRight));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R Hand", JointType.HandRight));

            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L Thigh", JointType.HipLeft));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L Calf", JointType.KneeLeft));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L Foot", JointType.AnkleLeft));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 L Toe0", JointType.FootLeft));

            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R Thigh", JointType.HipRight));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R Calf", JointType.KneeRight));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R Foot", JointType.AnkleRight));
            mapping.Add(new TgcKinectSkeletalMesh.Mapping("Bip01 R Toe0", JointType.FootRight));

            mesh.setBonesMapping(mapping);


            //Iniciar kinect
            tgcKinect = new TgcKinect();
            tgcKinect.init();
            tgcKinect.DebugSkeleton.init();


            GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(1.5467f, 54.7247f, 401.1074f), new Vector3(1.4672f, 54.4561f, 400.1474f));

            GuiController.Instance.Modifiers.addBoolean("mesh", "mesh", true);
            GuiController.Instance.Modifiers.addBoolean("skeleton", "skeleton", true);
        }