Exemplo n.º 1
0
 /* 12 floats */
 public PointLight(BaseLight light, Attenuation attenuation, Vector3 position)
 {
     this.light = light;
     this.attenuation = attenuation;
     this.position = position;
     this._pad1 = 0.0f;
 }
Exemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Title = "univ engine";

            shader = ShaderLibrary.Get("basic");
            line_shader = ShaderLibrary.Get("line");

            ObjLoader loader = new ObjLoader("teapot.obj");
            model = loader.Assemble();
            model.Rescale(0.02f);

            octree = new Octree(shader);
            octree.Rescale(10);

            axis = new Axis(line_shader);

            this.camera = new Camera(Width, Height);
            GL.Viewport(0, 0, Width, Height);

            /* lighting */
            sunlight = new DirectionalLight(new BaseLight(new Vector3(1.0f, 0.5f, 0.2f), 1.0f),
                                            new Vector3(0, -1, -2));
            ambient = new BaseLight(new Vector3(1.0f), 0.5f);
            point = new PointLight(new BaseLight(new Vector3(0.0f, 1.0f, 0.0f), 0.35f),
                                   new Attenuation(0.0f, 0.00f, 0.002f),
                                   new Vector3(7, 10, 0));

            shader.Use();
            /* f**k this shit for now */
            //shader.SetBlock<DirectionalLight>("sunlight", ref sunlight);
            //shader.SetBlock<BaseLight>("ambient", ref ambient);

            shader.SetBaseLight("ambient", ambient);
            shader.SetDirectionalLight("sunlight", sunlight);
            shader.SetPointLight("pointLights[0]", point);

            GL.Enable(EnableCap.DepthClamp);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Less);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);
            GL.ClearColor(Color.LightGray);
        }
Exemplo n.º 3
0
 /* 8 floats */
 public DirectionalLight(BaseLight light, Vector3 direction)
 {
     this.light = light;
     this.direction = direction;
     this._pad1 = 0.0f;
 }