better shader with sky/ground light, along with half lambert (#96)

* better shader with sky/ground light, along with half lambert

* force recalculate normal

* more wireframe/shade/normal mode!
This commit is contained in:
Kanglai Qian
2017-09-28 16:08:59 -05:00
committed by Perfare
parent 01f1d7c14e
commit bd7a43f0dc
3 changed files with 180 additions and 78 deletions

View File

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -13,13 +13,13 @@ namespace Unity_Studio {
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resource1 {
@ -33,7 +33,7 @@ namespace Unity_Studio {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@ -47,8 +47,8 @@ namespace Unity_Studio {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@ -61,28 +61,22 @@ namespace Unity_Studio {
}
/// <summary>
/// 查找类似 #version 140
/// Looks up a localized string similar to #version 140
///
///in vec3 surfaceNormal;
///in vec3 toLightVector;
///in vec4 color;
///in vec3 normal;
///
///out vec4 outputColor;
///
///void main()
///{
/// vec3 lightColor = vec3(0.5, 0.5, 0.5);
/// vec3 unitNormal = normalize(normal);
/// float nDotProduct = clamp(dot(unitNormal, vec3(0.707, 0, 0.707)), 0, 1);
/// vec2 ContributionWeightsSqrt = vec2(0.5, 0.5f) + vec2(0.5f, -0.5f) * unitNormal.y;
/// vec2 ContributionWeights = ContributionWeightsSqrt * ContributionWeightsSqrt;
///
/// // Ambient
/// float ambientStrength = 0.9;
/// vec3 ambient = ambientStrength * lightColor;
///
/// // Diffuse
/// vec3 unitNormal = normalize(surfaceNormal);
/// vec3 unitLightVector = normalize(toLightVector);
/// float nDotProduct = dot(unitNormal, unitLightVector);
/// float brightness = clamp(nDotProduct, 0, 1); // max(nDotProduct, 0.0);
/// vec3 diffuse [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// vec3 color = nDotProduct * vec3(1, 0.957, 0.839) / 3.14159;
/// color += vec3(0.779, 0.716, 0.453) * ContributionWeights.y;
/// color += vec3(0.368, 0.477, 0. [rest of string was truncated]&quot;;.
/// </summary>
internal static string fs {
get {
@ -91,25 +85,55 @@ namespace Unity_Studio {
}
/// <summary>
/// 查找类似 #version 140
/// Looks up a localized string similar to #version 140
///
///out vec4 outputColor;
///
///void main()
///{
/// outputColor = vec4(0, 0, 0, 1);
///}.
/// </summary>
internal static string fsBlack {
get {
return ResourceManager.GetString("fsBlack", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to #version 140
///
///out vec4 outputColor;
///in vec4 color;
///
///void main()
///{
/// outputColor = color;
///}.
/// </summary>
internal static string fsColor {
get {
return ResourceManager.GetString("fsColor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to #version 140
///
///in vec3 vertexPosition;
///in vec3 normalDirection;
///in vec4 vertexColor;
///uniform mat4 viewMatrix;
///
///out vec3 surfaceNormal;
///out vec3 toLightVector;
///out vec3 normal;
///out vec4 color;
///
///void main()
///{
/// vec3 lightPosition = vec3(200.0, 200.0, 200.0);
/// gl_Position = viewMatrix * vec4(vertexPosition, 1.0);
/// surfaceNormal = normalDirection;
/// toLightVector = lightPosition - vertexPosition;
/// normal = normalDirection;
/// color = vertexColor;
///} 的本地化字符串。
///}.
/// </summary>
internal static string vs {
get {