本文整理汇总了C#中Shader.SetDirectionalLight方法的典型用法代码示例。如果您正苦于以下问题:C# Shader.SetDirectionalLight方法的具体用法?C# Shader.SetDirectionalLight怎么用?C# Shader.SetDirectionalLight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader.SetDirectionalLight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnLoad
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();
/* fuck 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);
}