Esempio n. 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ModelLib.LoadContent(Content, "Models");
            TexLib.LoadContent(Content, "Models\\Textures");

            soundPlayer.InitSoundLibrary(Content);



            //view = new View(this.Window.ClientBounds.Width, this.Window.ClientBounds.Height);
            view = new MazeObjects.Maze();
            //view.Add(new GameObjects.GameObject3D(ModelLib.Get("Ball"), TexLib.Get("EyeTex")));
            // TODO: use this.Content to load your game content here


            effect = Content.Load <Effect>("Shaders\\PerPixelLighting");


            // cache the effect parameters
            cameraPositionParameter    = effect.Parameters["cameraPosition"];
            specularPowerParameter     = effect.Parameters["specularPower"];
            specularIntensityParameter = effect.Parameters["specularIntensity"];
            cameraPositionParameter    = effect.Parameters["cameraPosition"];

            //
            // set up some basic effect parameters that do not change during the
            // course of execution
            //

            // set the light colors
            effect.Parameters["ambientLightColor"].SetValue(new Vector4(255, 255, 255, 0));
            effect.Parameters["diffuseLightColor"].SetValue(Color.Red.ToVector4());
            effect.Parameters["specularLightColor"].SetValue(Color.White.ToVector4());

            // Set the light position to a fixed location.
            // This will place the light source behind, to the right, and above the
            // initial camera position.
            effect.Parameters["lightPosition"].SetValue(
                new Vector3(0f, 1f, 0f));
            effect.Parameters["lightRotation"].SetValue(view.Camera.rotationMatrix);


            effect.Parameters["FullStrengthDistance"].SetValue(0.5f);
            effect.Parameters["MaxDistance"].SetValue(1);

            colChecker = new CollisionChecker(view.GameObject3DList);
            colChecker.CreateBoxes();

            stepCounter = 0;

            soundPlayer.LoopMusic("BG1");
        }
Esempio n. 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ModelLib.LoadContent(Content, "Models");
            TexLib.LoadContent(Content, "Models\\Textures");

            soundPlayer.InitSoundLibrary(Content);

            //view = new View(this.Window.ClientBounds.Width, this.Window.ClientBounds.Height);
            view = new MazeObjects.Maze();
            //view.Add(new GameObjects.GameObject3D(ModelLib.Get("Ball"), TexLib.Get("EyeTex")));
            // TODO: use this.Content to load your game content here

            effect = Content.Load<Effect>("Shaders\\PerPixelLighting");

            // cache the effect parameters
            cameraPositionParameter = effect.Parameters["cameraPosition"];
            specularPowerParameter = effect.Parameters["specularPower"];
            specularIntensityParameter = effect.Parameters["specularIntensity"];
            cameraPositionParameter = effect.Parameters["cameraPosition"];

            //
            // set up some basic effect parameters that do not change during the
            // course of execution
            //

            // set the light colors
            effect.Parameters["ambientLightColor"].SetValue(new Vector4(255, 255, 255, 0));
            effect.Parameters["diffuseLightColor"].SetValue(Color.Red.ToVector4());
            effect.Parameters["specularLightColor"].SetValue(Color.White.ToVector4());

            // Set the light position to a fixed location.
            // This will place the light source behind, to the right, and above the
            // initial camera position.
            effect.Parameters["lightPosition"].SetValue(
                new Vector3(0f, 1f, 0f));
            effect.Parameters["lightRotation"].SetValue(view.Camera.rotationMatrix);

            effect.Parameters["FullStrengthDistance"].SetValue(0.5f);
            effect.Parameters["MaxDistance"].SetValue(1);

            colChecker = new CollisionChecker(view.GameObject3DList);
            colChecker.CreateBoxes();

            stepCounter = 0;

            soundPlayer.LoopMusic("BG1");
        }