コード例 #1
0
        protected override void LoadContent()
        {
            device = GraphicsDevice;
            cCross = new CoordCross(device);

            viewMatrix = Content.Load <Matrix>("camerasettings");
        }
コード例 #2
0
 protected override void LoadContent()
 {
     device          = graphics.GraphicsDevice;
     cCross          = new CoordCross(device);
     spacecraftModel = Content.Load <Model>("Ship");
     modelTransforms = new Matrix[spacecraftModel.Bones.Count];
 }
コード例 #3
0
        protected override void LoadContent()
        {
            device = graphics.GraphicsDevice;
            cCross = new CoordCross(device);

            terrain = new Terrain(device, Content);
        }
コード例 #4
0
 protected override void LoadContent()
 {
     device      = graphics.GraphicsDevice;
     basicEffect = new BasicEffect(device, null);
     InitVertices();
     cCross = new CoordCross(device);
 }
コード例 #5
0
 protected override void LoadContent()
 {
     device              = graphics.GraphicsDevice;
     basicEffect         = new BasicEffect(device, null);
     cCross              = new CoordCross(device);
     myVertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
 }
コード例 #6
0
 protected override void LoadContent()
 {
     device              = graphics.GraphicsDevice;
     basicEffect         = new BasicEffect(device, null);
     cCross              = new CoordCross(device);
     road                = Content.Load <Texture2D>("road");
     myVertexDeclaration = new VertexDeclaration(device, VertexPositionNormalTexture.VertexElements);
 }
コード例 #7
0
 protected override void LoadContent()
 {
     device      = graphics.GraphicsDevice;
     basicEffect = new BasicEffect(device, null);
     myTexture   = Content.Load <Texture2D>("XNAtexture");
     InitVertices();
     cCross = new CoordCross(device);
 }
コード例 #8
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            myModel = XNAUtils.LoadModelWithBoundingSphere(ref modelTransforms, "Ship", Content);
        }
コード例 #9
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            spriteBatch = new SpriteBatch(device);
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            terrain = new Terrain(device, Content);
        }
コード例 #10
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            myTexture = Content.Load <Texture2D>("billboardtexture");
            bbEffect  = Content.Load <Effect>("bbEffect");
        }
コード例 #11
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            myTexture = Content.Load <Texture2D>("billboardtexture");
            AddBillboards();
            myVertexDeclaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);
        }
コード例 #12
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);
            myTexture   = Content.Load <Texture2D>("XNAtexture");

            InitVertices();
            InitIndices();
            vertices = GenerateNormalsForTriangleList(vertices, indices);
        }
コード例 #13
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            spriteBatch = new SpriteBatch(device);
            cCross      = new CoordCross(device);

            PresentationParameters pp = device.PresentationParameters;

            resolveTexture = new ResolveTexture2D(device, pp.BackBufferWidth, pp.BackBufferHeight, 1, device.DisplayMode.Format);
        }
コード例 #14
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            myModel         = Content.Load <Model>("Ship");
            modelTransforms = new Matrix[myModel.Bones.Count];

            Effect ppEffect = Content.Load <Effect>("postprocessing");

            postProcessor = new PostProcessor(device, ppEffect);
        }
コード例 #15
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);
            spriteBatch = new SpriteBatch(device);

            PresentationParameters pp = device.PresentationParameters;
            int width  = pp.BackBufferWidth / 2;
            int height = pp.BackBufferHeight / 4;

            renderTarget = new RenderTarget2D(device, width, height, 1, device.DisplayMode.Format);
            rendertargetProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)width / (float)height, 0.5f, 100.0f);
        }
コード例 #16
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            myTexture = Content.Load <Texture2D>("explosion");
            expEffect = Content.Load <Effect>("explosionEffect");

            myVertexDeclaration = new VertexDeclaration(device, VertexExplosion.VertexElements);

            //only used to render one line of text!
            spriteBatch = new SpriteBatch(device);
            spriteFont  = Content.Load <SpriteFont>("arial");
        }
コード例 #17
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            myModel         = Content.Load <Model>("Ship");
            modelTransforms = new Matrix[myModel.Bones.Count];

            PresentationParameters pp = GraphicsDevice.PresentationParameters;

            targetRenderedTo     = new RenderTarget2D(device, pp.BackBufferWidth, pp.BackBufferHeight, 1, device.DisplayMode.Format);
            resolveTexture       = new ResolveTexture2D(device, pp.BackBufferWidth, pp.BackBufferHeight, 1, device.DisplayMode.Format);
            postProcessingEffect = Content.Load <Effect>("postprocessing");
        }
コード例 #18
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            PresentationParameters pp = device.PresentationParameters;
            int width  = pp.BackBufferWidth;
            int height = pp.BackBufferHeight;

            renderTarget = new RenderTarget2D(device, width, height, 1, device.DisplayMode.Format);
            mirrorEffect = Content.Load <Effect>("mirrorEffect");

            myModel         = Content.Load <Model>("dude");
            modelTransforms = new Matrix[myModel.Bones.Count];
        }
コード例 #19
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);
            cCross      = new CoordCross(device);

            Texture2D heightMap = Content.Load <Texture2D>("heightmap");

            heightData = LoadHeightData(heightMap);

            grassTexture = Content.Load <Texture2D>("grass");

            myVertexDeclaration = new VertexDeclaration(device, VertexPositionNormalTexture.VertexElements);
            VertexPositionNormalTexture[] terrainVertices = CreateTerrainVertices();
            int[] terrainIndices = CreateTerrainIndices();
            terrainVertices = GenerateNormalsForTriangleStrip(terrainVertices, terrainIndices);
            CreateBuffers(terrainVertices, terrainIndices);
        }
コード例 #20
0
        protected override void LoadContent()
        {
            device = graphics.GraphicsDevice;
            cCross = new CoordCross(device);

            Texture2D grassTexture = Content.Load <Texture2D>("grass");

            Texture2D heightMap = Content.Load <Texture2D>("heightmap");
            int       width     = heightMap.Width;
            int       height    = heightMap.Height;

            float[,] heightData = TerrainUtils.LoadHeightData(heightMap);
            VertexPositionNormalTexture[] vertices = TerrainUtils.CreateTerrainVertices(heightData);
            int[] indices = TerrainUtils.CreateTerrainIndices(width, height);
            vertices = TerrainUtils.GenerateNormalsForTriangleStrip(vertices, indices);
            VertexPositionNormalTexture[,] vertexArray = Reshape1Dto2D <VertexPositionNormalTexture>(vertices, width, height);

            rootNode = new QTNode(vertexArray, device, grassTexture, 64);
        }
コード例 #21
0
        protected override void LoadContent()
        {
            device       = graphics.GraphicsDevice;
            basicEffect  = new BasicEffect(device, null);
            cCross       = new CoordCross(device);
            grassTexture = Content.Load <Texture2D>("grass");

            Texture2D heightMap = Content.Load <Texture2D>("heightmap");

            heightData = LoadHeightData(heightMap);

            myVertexDeclaration = new VertexDeclaration(device, VertexPositionNormalTexture.VertexElements);
            VertexPositionNormalTexture[] terrainVertices = CreateTerrainVertices();
            int[] terrainIndices = CreateTerrainIndices();
            terrainVertices     = GenerateNormalsForTriangleStrip(terrainVertices, terrainIndices);
            terrainVertexBuffer = new VertexBuffer(device, VertexPositionNormalTexture.SizeInBytes * terrainVertices.Length, BufferUsage.WriteOnly);
            terrainVertexBuffer.SetData(terrainVertices);

            int      terrainSize   = 1024;
            Triangle leftTriangle  = new Triangle(null, new Vector2(0, 0), new Vector2(terrainSize, 0), new Vector2(0, terrainSize), heightData);
            Triangle rightTriangle = new Triangle(null, new Vector2(terrainSize, terrainSize), new Vector2(0, terrainSize), new Vector2(terrainSize, 0), heightData);

            leftTriangle.AddNeighs(null, null, rightTriangle);
            rightTriangle.AddNeighs(null, null, leftTriangle);

            triangleList = new List <Triangle>();
            triangleList.Add(leftTriangle);
            triangleList.Add(rightTriangle);

            indicesList = new List <int>();
            foreach (Triangle t in triangleList)
            {
                t.AddIndices(ref indicesList);
            }

            dynTerrainIndexBuffer = new DynamicIndexBuffer(device, typeof(int), indicesList.Count, BufferUsage.WriteOnly);
            dynTerrainIndexBuffer.SetData(indicesList.ToArray(), 0, indicesList.Count, SetDataOptions.Discard);
            dynTerrainIndexBuffer.ContentLost += new EventHandler(dynIndexBuffer_ContentLost);

            orthoView = Matrix.CreateLookAt(new Vector3(terrainSize / 2, 100, -terrainSize / 2), new Vector3(terrainSize / 2, 0, -terrainSize / 2), Vector3.Forward);
            orthoProj = Matrix.CreateOrthographic(terrainSize, terrainSize, 1, 1000);
        }
コード例 #22
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Load our fonts into the static Font class
            Fonts.LoadContent(Content);

            device = graphics.GraphicsDevice;
            cCross = new CoordCross(device);

            weapon = Content.Load<Model>("weapon");
            crosshair = Content.Load<Texture2D>("crosshair1");
            // Initialize the weapon matrices.
            weaponTransforms = new Matrix[weapon.Bones.Count];
            weaponWorldMatrix = Matrix.Identity;

            terrain = new Terrain(device, Content);
            dino = Content.Load<Model>("dino");
            spherePrimitive = new SpherePrimitive(GraphicsDevice, 0.5f, 12);
        }