Esempio n. 1
0
        protected override void OnResize(EventArgs e)
        {
            camera.SetSize(ClientSize.Width, ClientSize.Height);

            UnloadFactory.Set(ref gBuffer, new DeferredGBuffer(Width, Height));

            //screenCenter = new Point(Bounds.Left + (Bounds.Width / 2), Bounds.Top + (Bounds.Height / 2));
            //windowCenter = new Point(Width / 2, Height / 2);

            Debug.Info("...");
        }
Esempio n. 2
0
        public static Shader GetShader(Resource resource)
        {
            Shader s;

            if (!allShaders.TryGetValue(resource, out s))
            {
                s = new Shader(resource);
                s.Load(resource);
                allShaders[resource] = s;
                UnloadFactory.Add(s);
            }
            return(s);
        }
Esempio n. 3
0
        public EngineMain()
            : base(1400, 900,
                   new GraphicsMode(), "MyEngine", GameWindowFlags.Default,
                   DisplayDevice.Default, 3, 2,
                   GraphicsContextFlags.ForwardCompatible | GraphicsContextFlags.Debug)
        {
            instance = this;
            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.High;

            VSync = VSyncMode.Off;

            Texture2D.InitTexture2D();
            UnloadFactory.Set(ref ubo, new UniformBlock());
            new PhysicsUsage.PhysicsManager();
        }
Esempio n. 4
0
        public static Mesh GetMesh(Resource resource, bool allowDuplicates = false)
        {
            if (!resource.originalPath.EndsWith(".obj"))
            {
                throw new System.Exception("Resource path does not end with .obj");
            }

            Mesh s;

            if (allowDuplicates || !allMeshes.TryGetValue(resource, out s))
            {
                s = ObjLoader.Load(resource);
                allMeshes[resource] = s;
                UnloadFactory.Add(s);
            }
            return(s);
        }