Пример #1
0
        protected override void OnLoad(EventArgs e)
        {
            GL.DepthRange(0.0f, 1.0f);
            base.OnLoad(e);
            light  = new Light(new Vector3(-1f, -1f, -1f), new Vector3(lightColour1.X, lightColour1.Y, lightColour1.Z), light1Intensity, lightRadius, Light.LightType.LIGHT_POINT);
            light2 = new Light(new Vector3(5f, 10f, 5f), new Vector3(lightColour2.X, lightColour2.Y, lightColour2.Z), light2Intensity, 1.0f, Light.LightType.LIGHT_DIRECTIONAL);
            light3 = new Light(new Vector3(1f, -1f, 5f), new Vector3(lightColour3.X, lightColour3.Y, lightColour3.Z), light3Intensity, 1.0f, Light.LightType.LIGHT_DIRECTIONAL);
            int num = 6;

            for (int i = 0; i < num; i++)
            {
                for (int j = 0; j < num; j++)
                {
                    for (int k = 0; k < num; k++)
                    {
                        Meshes[i + j] = new MeshComponent("Meshes/sphere_lowres.obj");
                        Meshes[i + j].SetTranslation(i * 25, j * 25, k * 25);
                    }
                }
            }

            Q = new FullscreenQuad(ShaderType_BL.DebugGBuffer, ShaderFlags.NONE);

            tex         = new Texture("Textures/test.png");
            tex2        = new Texture("Textures/testnormal.png");
            _controller = new ImGuiController(Width, Height);
            _controller.CreateSkin();
            player = new Player();
            DeferredRenderer.SetupGBuffer();
            q = new FullscreenQuad(ShaderManager.ShaderType_BL.Default, ShaderManager.ShaderFlags.NONE);
        }
Пример #2
0
        public Light(Vector3 pos, Vector3 col, float intensity, float radius, LightType type)
        {
            lightType = type;
            if (lightType == LightType.LIGHT_DIRECTIONAL)
            {
                Q = new FullscreenQuad(ShaderManager.ShaderType_BL.DeferredLight, ShaderManager.ShaderFlags.LIT | ShaderManager.ShaderFlags.LIGHT_DIRECTIONAL);
            }
            if (lightType == LightType.LIGHT_POINT)
            {
                Q = new FullscreenQuad(ShaderManager.ShaderType_BL.DeferredLight, ShaderManager.ShaderFlags.LIT | ShaderManager.ShaderFlags.LIGHT_POINT);
            }

            lightPosition  = pos;
            lightColour    = col;
            lightIntensity = intensity;
            lightRadius    = radius;

            DeferredRenderer.AddLightToRenderer(this);
        }