Ejemplo n.º 1
0
        /*
         * public Model
         *  BloomViewboard,
         *  BloomViewboard2,
         *  CompositeViewboard,
         *  AoViewboard,
         *  AoBlrViewboard;
         */

        public Scene(OpenTkProjectWindow mGameWindow)
        {
            //prepare list of world textures
            int texCount = Enum.GetValues(typeof(Material.WorldTexture)).Length;

            if (worldTextures == null)
            {
                worldTextures = new Texture[texCount];
            }

            this.gameWindow = mGameWindow;
            Scene           = this;
            //sunLight.pointingDirection = Vector3.Normalize(new Vector3(674, 674, 1024));

            // creating a new collision system and adding it to the new world
            CollisionSystem collisionSystem = new CollisionSystemSAP();

            world = new World(collisionSystem);

            // Create the groundShape and the body.
            Shape     groundShape = new BoxShape(new JVector(100, waterLevel * 2, 100));
            RigidBody groundBody  = new RigidBody(groundShape);


            // make the body static, so it can't be moved
            groundBody.IsStatic = true;

            // add the ground to the world.
            world.AddBody(groundBody);
        }
Ejemplo n.º 2
0
        /*
        public Model
            BloomViewboard,
            BloomViewboard2,
            CompositeViewboard,
            AoViewboard,
            AoBlrViewboard;
         */
        public Scene(OpenTkProjectWindow mGameWindow)
        {
            //prepare list of world textures
            int texCount = Enum.GetValues(typeof(Material.WorldTexture)).Length;
            if (worldTextures == null)
                worldTextures = new Texture[texCount];

            this.gameWindow = mGameWindow;
            Scene = this;
            //sunLight.pointingDirection = Vector3.Normalize(new Vector3(674, 674, 1024));

            // creating a new collision system and adding it to the new world
            CollisionSystem collisionSystem = new CollisionSystemSAP();
            world = new World(collisionSystem);

            // Create the groundShape and the body.
            Shape groundShape = new BoxShape(new JVector(100, waterLevel * 2, 100));
            RigidBody groundBody = new RigidBody(groundShape);

            // make the body static, so it can't be moved
            groundBody.IsStatic = true;

            // add the ground to the world.
            world.AddBody(groundBody);
        }
Ejemplo n.º 3
0
        public FileSeeker(OpenTkProjectWindow mGameWindow)
        {
            this.gameWindow = mGameWindow;

            string root = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            List<string> files = GetFileList(root, true);

            foreach (var file in files)
            {
                string relativePath = file.Substring(root.Length + 1);
                string extention = System.IO.Path.GetExtension(file);

                switch (extention)
                {
                    case ".obj":
                        mGameWindow.log("found object file: " + relativePath);
                        mGameWindow.meshLoader.fromObj(relativePath);
                        break;
                    case ".dae":
                        mGameWindow.log("found object file: " + relativePath);
                        mGameWindow.meshLoader.fromCollada(relativePath);
                        break;
                    case ".xmd":
                        mGameWindow.log("found object definition file: " + relativePath);
                        mGameWindow.meshLoader.fromXml(relativePath);
                        break;
                    case ".png":
                        mGameWindow.log("found image file: " + relativePath);
                        mGameWindow.textureLoader.fromPng(relativePath);
                        break;
                    case ".dds":
                        mGameWindow.log("found image file: " + relativePath);
                        mGameWindow.textureLoader.fromDds(relativePath);
                        break;
                    case ".xmf":
                        mGameWindow.log("found material file: " + relativePath);
                        mGameWindow.materialLoader.fromXmlFile(relativePath);
                        break;
                    case ".xsp":
                        mGameWindow.log("found shaderpair file: " + relativePath);
                        mGameWindow.shaderLoader.fromXmlFile(relativePath);
                        break;
                    case ".snip":
                        mGameWindow.log("found shader snipet: " + relativePath);
                        mGameWindow.shaderLoader.loadSnippet(relativePath);
                        break;
                    case ".xtmp":
                        mGameWindow.log("found template file: " + relativePath);
                        mGameWindow.templateLoader.fromXmlFile(relativePath);
                        break;
                    default:
                        break;
                }
            }
        }
Ejemplo n.º 4
0
        public FileSeeker(OpenTkProjectWindow mGameWindow)
        {
            this.gameWindow = mGameWindow;

            string root = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            List<string> files = GetFileList(root, true);

            foreach (var file in files)
            {
                string relativePath = file.Substring(root.Length + 1);
                string extention = System.IO.Path.GetExtension(file);
                if (extention == ".obj")
                {
                    mGameWindow.log("found object file: " + relativePath);
                    mGameWindow.meshLoader.fromObj(relativePath);
                }
                if (extention == ".png")
                {
                    mGameWindow.log("found image file: " + relativePath);
                    mGameWindow.textureLoader.fromFile(relativePath,true);
                }
                if (extention == ".xmf")
                {
                    mGameWindow.log("found material file: " + relativePath);
                    mGameWindow.materialLoader.fromXmlFile(relativePath);
                }
                if (extention == ".xsp")
                {
                    mGameWindow.log("found shaderpair file: " + relativePath);
                    mGameWindow.shaderLoader.fromXmlFile(relativePath);
                }
                if (extention == ".xtmp")
                {
                    mGameWindow.log("found template file: " + relativePath);
                    mGameWindow.templateLoader.fromXmlFile(relativePath);
                }
            }
        }
Ejemplo n.º 5
0
        public static void Main()
        {
            if (!File.Exists("settings.xml"))
            {
                // settings is not existing, lets save default ones
                Settings.Instance.SaveSettings("settings.xml");

                // we can create gui at this point when it is implemented
            }

            Settings.Instance.LoadSettings("settings.xml");


            int  scrWidth  = Settings.Instance.video.windowWidth;
            int  scrHeight = Settings.Instance.video.windowHeight;
            bool fullScr   = Settings.Instance.video.fullScreen;

            using (OpenTkProjectWindow game = new OpenTkProjectWindow(scrWidth, scrHeight, fullScr))
            {
                game.Run(60);
            }
        }
Ejemplo n.º 6
0
        public FileSeeker(OpenTkProjectWindow mGameWindow)
        {
            this.gameWindow = mGameWindow;

            string root = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            List <string> files = GetFileList(root, true);

            foreach (var file in files)
            {
                string relativePath = file.Substring(root.Length + 1);
                string extention    = System.IO.Path.GetExtension(file);

                switch (extention)
                {
                case ".obj":
                    mGameWindow.log("found object file: " + relativePath);
                    mGameWindow.meshLoader.fromObj(relativePath);
                    break;

                case ".dae":
                    mGameWindow.log("found object file: " + relativePath);
                    mGameWindow.meshLoader.fromCollada(relativePath);
                    break;

                case ".xmd":
                    mGameWindow.log("found object definition file: " + relativePath);
                    mGameWindow.meshLoader.fromXml(relativePath);
                    break;

                case ".png":
                    mGameWindow.log("found image file: " + relativePath);
                    mGameWindow.textureLoader.fromPng(relativePath);
                    break;

                case ".dds":
                    mGameWindow.log("found image file: " + relativePath);
                    mGameWindow.textureLoader.fromDds(relativePath);
                    break;

                case ".xmf":
                    mGameWindow.log("found material file: " + relativePath);
                    mGameWindow.materialLoader.fromXmlFile(relativePath);
                    break;

                case ".xsp":
                    mGameWindow.log("found shaderpair file: " + relativePath);
                    mGameWindow.shaderLoader.fromXmlFile(relativePath);
                    break;

                case ".snip":
                    mGameWindow.log("found shader snipet: " + relativePath);
                    mGameWindow.shaderLoader.loadSnippet(relativePath);
                    break;

                case ".xtmp":
                    mGameWindow.log("found template file: " + relativePath);
                    mGameWindow.templateLoader.fromXmlFile(relativePath);
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 7
0
 public FramebufferCreator(OpenTkProjectWindow gameWindow)
 {
     this.gameWindow = gameWindow;
     //defaultFb = createFrameBuffer( mGameWindow.Width, mGameWindow.Height);
     defaultFb = new DefaultFramebuffer(new Vector2(gameWindow.Width, gameWindow.Height), this);
 }
Ejemplo n.º 8
0
 public MaterialLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Ejemplo n.º 9
0
 public TextureLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Ejemplo n.º 10
0
 protected GameObject(OpenTkProjectWindow gameWindow)
 {
     this.gameWindow = gameWindow;
 }
Ejemplo n.º 11
0
 public TemplateLoader(OpenTkProjectWindow gameWindow)
     : base(gameWindow)
 {
 }
Ejemplo n.º 12
0
 public TemplateLoader(OpenTkProjectWindow gameWindow)
     : base(gameWindow)
 {
 }
Ejemplo n.º 13
0
        /*
        public Model
            BloomViewboard,
            BloomViewboard2,
            CompositeViewboard,
            AoViewboard,
            AoBlrViewboard;
         */
        public Scene(OpenTkProjectWindow mGameWindow)
        {
            this.gameWindow = mGameWindow;
            Scene = this;

            sunLight = new LightSun(new Vector3(0.1f, 0.125f, 0.2f) * 3f, this);
            sunLight.lightAmbient = new Vector3(0.1f, 0.125f, 0.2f) * 0.5f;//new Vector3(0.2f, 0.125f, 0.1f);//new Vector3(0.1f, 0.14f, 0.3f);
            sunLight.PointingDirection = Vector3.Normalize(new Vector3(674, -674, 1024));
            sunFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);
            sunInnerFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);

            //sunLight.pointingDirection = Vector3.Normalize(new Vector3(674, 674, 1024));

            // creating a new collision system and adding it to the new world
            CollisionSystem collisionSystem = new CollisionSystemSAP();
            world = new World(collisionSystem);

            // Create the groundShape and the body.
            Shape groundShape = new BoxShape(new JVector(100, waterLevel * 2, 100));
            RigidBody groundBody = new RigidBody(groundShape);

            // make the body static, so it can't be moved
            groundBody.IsStatic = true;

            // add the ground to the world.
            world.AddBody(groundBody);
        }
Ejemplo n.º 14
0
 public ShaderLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Ejemplo n.º 15
0
 public TextureLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Ejemplo n.º 16
0
 protected GameObject(OpenTkProjectWindow gameWindow)
 {
     this.gameWindow = gameWindow;
 }
Ejemplo n.º 17
0
 public static void Main()
 {
     using (OpenTkProjectWindow game = new OpenTkProjectWindow())
     {
         //Utilities.SetWindowTitle(example);
         game.Run(60);
     }
 }
Ejemplo n.º 18
0
 public MaterialLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Ejemplo n.º 19
0
 public ShaderLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Ejemplo n.º 20
0
 public FramebufferCreator(OpenTkProjectWindow gameWindow)
 {
     this.gameWindow = gameWindow;
     //defaultFb = createFrameBuffer( mGameWindow.Width, mGameWindow.Height);
     defaultFb = new DefaultFramebuffer(new Vector2(gameWindow.Width, gameWindow.Height), this);
 }