Example #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);
        }
Example #2
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;
                }
            }
        }
Example #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);
                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);
                }
            }
        }
Example #4
0
 public ShaderLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Example #5
0
 public static void Main()
 {
     using (OpenTkProjectWindow game = new OpenTkProjectWindow())
     {
         //Utilities.SetWindowTitle(example);
         game.Run(60);
     }
 }
Example #6
0
 protected GameObject(OpenTkProjectWindow gameWindow)
 {
     this.gameWindow = gameWindow;
 }
Example #7
0
 public MaterialLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Example #8
0
 public TextureLoader(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Example #9
0
 public TemplateLoader(OpenTkProjectWindow gameWindow)
     : base(gameWindow)
 {
 }
Example #10
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);
        }
 public FramebufferCreator(OpenTkProjectWindow gameWindow)
 {
     this.gameWindow = gameWindow;
     //defaultFb = createFrameBuffer( mGameWindow.Width, mGameWindow.Height);
     defaultFb = new DefaultFramebuffer(new Vector2(gameWindow.Width, gameWindow.Height), this);
 }