Esempio n. 1
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager c, Microsoft.Xna.Framework.Graphics.GraphicsDevice g)
        {
            base.LoadContent(c, g);

            primBatch = new PrimitiveBatch(Device);
            cam = new FirstPersonCamera(0.5f, 10);
            cam.Pos = new Vector3(3, 3, 13);

            balls = new List<Ball>();

            for (int i = 0; i < 50; i++)
            {
                balls.Add(new Ball(new Vector3(i * 2, 2, 2), new Vector3(i + 1, -i, i % 2) * 0.1f, 0.5f));
            }

            planes = new List<Plane>();

            planes.Add(new Plane(Vector3.Right, 0));
            planes.Add(new Plane(Vector3.Up, 0));
            planes.Add(new Plane(new Vector3(0, 0, 1), 0));
            planes.Add(new Plane(Vector3.Left, -10));
            planes.Add(new Plane(Vector3.Down, -10));
            planes.Add(new Plane(new Vector3(0, 0, -1), -10));

            MeshBuilder mb = new MeshBuilder(g);
            sphere = mb.CreateSphere(1f, 10, 10);
        }
Esempio n. 2
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.LoadContent(content);

            BlockData.Initialize(Device, content);

            cam = new FirstPersonCamera(0.5f, 10);
            cam.Pos = new Vector3(3, 3, 13);


            map = new Map(Device);

            partition = new MapPartition(map);
            engine = new PhysicsEngine3D(partition);

            MeshBuilder mb = new MeshBuilder(Device);
            sphere = mb.CreateSphere(0.1f, 10, 10);
            marker = new MeshNode(sphere);

            placeType = 1;

            primBatch = new PrimitiveBatch(Device);


        }
Esempio n. 3
0
        //A scenegraph is composed of SceneNodes
        public override void LoadContent(ContentManager content, GraphicsDevice g)
        {
            base.LoadContent(content, g);

            //Set up our camera and primitive renderer
            cam = new FirstPersonCamera(0.5f, 5f);        //0.5f is the turn speed for the camera, and 5f is the translational speed
            cam.Pos = new Vector3(3, 3, 13);              //Move our camera to the point (3, 3, 13)
            primBatch = new PrimitiveBatch(g);            //Initialize our PrimitiveBatch

            //Define the objects in our scene
            Mesh sphere, cylinder, box;                   //Define the meshes we will use for the robot arm
                                                          //A mesh holds a list of vertices, and a list of indices which represent triangles

            MeshNode arm, elbow, forearm, wrist, hand;    //Define all the parts of the robot arm we will use

            MeshBuilder mb = new MeshBuilder(g);          //MeshBuilder is a helper class for generating 3D geometry
                                                          //It has some built in functions to create primitives, as well as
                                                          //functions to create your own arbitrary meshes

            //Genererate our geometry
            //All geometry created is centered around the origin in its local coordinate system
            sphere = mb.CreateSphere(0.5f, 15, 15);       //Create a sphere mesh, with radius 0.5 and with 15 subdivisions
            cylinder = mb.CreateCylinder(0.3f, 2.0f, 15); //Create a cylinder with radius 0.3, a height of 2, and 15 subdivisions
            box = mb.CreateBox(0.8f, 1.4f, 0.1f);         //Create a box with width 0.8, height of 1.4, and depth of 0.1

            shoulder = new MeshNode(sphere);              //Assign the sphere mesh to our shoulder node

            arm = new MeshNode(cylinder);                 //Assign the cylinder mesh to our arm node
            arm.SetPos(new Vector3(0, -1, 0));            //Translate the arm down 1 on the y axis

            elbow = new MeshNode(sphere);                 //Assign a sphere to our elbow node
            elbow.SetPos(new Vector3(0, -2, 0));          //Translate the elbow down 2 on the y axis

            forearm = new MeshNode(cylinder);             //Assign a cylinder to our forearm node
            forearm.SetPos(new Vector3(0, -1, 0));        //Translate the forearm down 1 on the y axis

            wrist = new MeshNode(sphere);                 //Assign a sphere for the wrist node
            wrist.SetPos(new Vector3(0, -2, 0));          //Translate the wrist down 2 on the y axis

            hand = new MeshNode(box);                     //Assign the box to the hand node
            hand.SetPos(new Vector3(0, -0.7f, 0));        //Translate the hand down 0.7 (half the height of the box) on the y axis

            shoulder.AddChild(arm);                       //The shoulder is the root of this scene, in our case. It is the parent
            shoulder.AddChild(elbow);                     //of both the arm and the elbow

            elbow.AddChild(forearm);                      //The elbow is the parent of the forearm and wrist
            elbow.AddChild(wrist);

            wrist.AddChild(hand);                         //The wrist is the parent of the hand

            shoulder.SetPos(new Vector3(0, 5, 0));        //This call effectively translates the entire arm up 5 on the y axis
        }
Esempio n. 4
0
        public override void LoadContent(ContentManager content, GraphicsDevice g)
        {
            base.LoadContent(content, g);

            primBatch = new PrimitiveBatch(Device);
            cam = new FirstPersonCamera(0.5f, 10);
            cam.Pos = new Vector3(3, 3, 13);

            MeshBuilder mb = new MeshBuilder(g);
            sphere = mb.CreateSphere(1f, 10, 10);

            setupEngine();
        }
        public override void LoadContent(ContentManager content, GraphicsDevice g)
        {
            base.LoadContent(content, g);

            //Set up our camera and primitive renderer
            cam = new FirstPersonCamera(0.5f, 5f);
            cam.Pos = new Vector3(5, 1, 10);
            primBatch = new PrimitiveBatch(g);

            animation = Animation.Parse("Content/MotionCaptures/BriskWalk1_All.tsv");

            spheres = new List<MeshNode>();
            MeshBuilder mb = new MeshBuilder(Device);

            for (int i = 0; i < animation.GetNumMarkers(); i++)
            {
                spheres.Add(new MeshNode(mb.CreateSphere(0.06f, 10, 10)));
            }
        }
Esempio n. 6
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.LoadContent(content);

            BlockData.Initialize(Device, content);

            //map = new Map(Device, "Content/Levels/ramps.txt"); //Load map
            map = new Map(Device, "Content/Levels/Level1-1.txt");

            MeshBuilder mb = new MeshBuilder(Device);

            buildWalls(mb, content);

            setupNormalMapEffect(content);

            if (singleplayer)
            {
                objectiveLocation = map.getNextObjective(new Vector3(-1, -1, -1)); //get first objective
            }

            partition = new MapPartition(map);

            player = new Player(new Vector3(map.Width/2,20,map.Depth - 2)); //spawn player

            initializePhysicsEngine();

            //Misc initialization stuff
            sphere = mb.CreateSphere(1f, 10, 10);
            destination = mb.CreateSphere(0.5f, 12, 12); //sphere to draw at objective
            destination.Texture = content.Load<Texture2D>("Textures/BlockTextures/Destination");

            sBatch = new SpriteBatch(Device);
            sf = content.Load<SpriteFont>("Fonts/Helvetica");
            primBatch = new PrimitiveBatch(Device);

            playerColor = new Vector3((int.Parse(localPlayerName) % 5) / 5.0f, (int.Parse(localPlayerName) % 3) / 3.0f, (int.Parse(localPlayerName) % 2) / 2.0f);
        }