コード例 #1
0
ファイル: Window.cs プロジェクト: johanhenriksson/univ
        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);
        }
コード例 #2
0
ファイル: DrawEventArgs.cs プロジェクト: johanhenriksson/univ
 public DrawEventArgs(Scene scene, Camera camera, Matrix4 model)
 {
     this.scene = scene;
     this.camera = camera;
     this.ModelMatrix = model;
 }