mirror of https://github.com/teverse/teverse
Compare commits
4 Commits
f5346a4383
...
9f22dbeda8
Author | SHA1 | Date |
---|---|---|
Jay | 9f22dbeda8 | |
Jay | fed726139e | |
Jay | a4d81aa668 | |
Jay | 39fecf6e54 |
|
@ -1,7 +1,8 @@
|
|||
local function createApp(app)
|
||||
local appGui = teverse.construct("guiFrame", {
|
||||
strokeAlpha = 0.1,
|
||||
strokeRadius = 4
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper.hoverColour(appGui, colour.rgb(247, 247, 247))
|
||||
|
|
|
@ -18,7 +18,9 @@ return {
|
|||
size = guiCoord(1/3, -20, 0, 70),
|
||||
position = guiCoord(0, 10, 0, 60),
|
||||
backgroundColour = colour.rgb(74, 140, 122),
|
||||
strokeRadius = 3
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
|
@ -71,7 +73,9 @@ return {
|
|||
size = guiCoord(1/3, -20, 0, 70),
|
||||
position = guiCoord(1/3, 10, 0, 0),
|
||||
backgroundColour = colour.rgb(74, 140, 122),
|
||||
strokeRadius = 3
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
|
|
|
@ -182,7 +182,9 @@ return {
|
|||
size = guiCoord(1/3, -20, 0, 70),
|
||||
position = guiCoord(0, 10, 0, 0),
|
||||
backgroundColour = colour.rgb(74, 140, 122),
|
||||
strokeRadius = 3
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
|
@ -239,7 +241,9 @@ return {
|
|||
size = guiCoord(1/3, -20, 0, 70),
|
||||
position = guiCoord(1/3, 10, 0, 0),
|
||||
backgroundColour = colour.rgb(235, 187, 83),
|
||||
strokeRadius = 3
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
|
@ -304,7 +308,9 @@ return {
|
|||
size = guiCoord(1/3, -20, 0, 70),
|
||||
position = guiCoord(2/3, 10, 0, 0),
|
||||
backgroundColour = colour.rgb(216, 100, 89),
|
||||
strokeRadius = 3
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
|
@ -386,12 +392,13 @@ return {
|
|||
|
||||
local input = teverse.construct("guiTextBox", {
|
||||
parent = feedItems,
|
||||
size = guiCoord(1, -20, 0, 30),
|
||||
position = guiCoord(0, 10, 0, 10),
|
||||
strokeAlpha = 0.15,
|
||||
strokeRadius = 3,
|
||||
size = guiCoord(1, -2, 0, 30),
|
||||
position = guiCoord(0, 1, 0, 10),
|
||||
textEditable = true,
|
||||
textAlign = "topLeft"
|
||||
textAlign = "topLeft",
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
local newestFeed = ""
|
||||
|
|
|
@ -99,7 +99,7 @@ local function loadTutorialPage(tutorial, pagei, lessonFrame)
|
|||
size = guiCoord(1.0, -20, 0.5, -(textDimensions + 60)),
|
||||
position = guiCoord(0, 10, 0.5, textDimensions + 10)
|
||||
}).bind(output, "md", {
|
||||
size = guiCoord(1.0, -20, 1, -(textDimensions + 102)),
|
||||
size = guiCoord(0.5, -20, 1, -(textDimensions + 102)),
|
||||
position = guiCoord(0.5, 10, 0, textDimensions + 52)
|
||||
})
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
$input v_worldPos, v_view, v_normal, v_tangent, v_bitangent, v_color0, v_position
|
||||
|
||||
#include <teverse.sh>
|
||||
|
||||
/*
|
||||
* Portions of this file may have been directly taken or adapted from the following open sourced projects:
|
||||
*
|
||||
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
||||
*
|
||||
*/
|
||||
|
||||
uniform vec4 u_lightRgbInnerR;
|
||||
uniform vec4 u_materialInfo;
|
||||
uniform vec4 u_camPos;
|
||||
uniform mat4 u_normalMatrix;
|
||||
|
||||
float remapRoughness(float x)
|
||||
{
|
||||
return 2.0f * (1.0f / (1.0f - 0.5f + 0.001f) - 1.0f) * (pow(x, 2)) + 0.001f;
|
||||
}
|
||||
|
||||
float schlick(float R0, float cos_theta)
|
||||
{
|
||||
float R = R0 + (1.0 - R0) * pow((1.0 - cos_theta), 5.0);
|
||||
return R;
|
||||
}
|
||||
|
||||
float roughSchlick2(float R0, float cos_theta, float roughness)
|
||||
{
|
||||
float area_under_curve = 1.0 / 6.0 * (5.0 * R0 + 1.0);
|
||||
float new_area_under_curve = 1.0 / (6.0 * roughness + 6.0) * (5.0 * R0 + 1.0);
|
||||
|
||||
return schlick(R0, cos_theta) /
|
||||
(1.0 + roughness) + (area_under_curve - new_area_under_curve);
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 normal = v_tangent + v_bitangent + v_normal;
|
||||
|
||||
vec3 wnormal = normalize(mul(mul(u_invView, vec4(v_normal,0.0) ), u_normalMatrix)).xyz;
|
||||
|
||||
vec3 view = mul(u_view, vec4(v_worldPos, 0.0) ).xyz;
|
||||
view = normalize(view);
|
||||
|
||||
vec3 v = normalize(u_camPos.xyz-view);
|
||||
float cos_theta = max(dot(normalize(v_position), wnormal), 0.0f);
|
||||
float remapped_roughness = remapRoughness(u_materialInfo.y);
|
||||
float fresnel_term = roughSchlick2(0.04, cos_theta, remapped_roughness);
|
||||
|
||||
gl_FragData[0] = vec4(u_lightRgbInnerR.xyz, fresnel_term);
|
||||
gl_FragData[1] = vec4(wnormal, 1.0);
|
||||
gl_FragData[2] = u_materialInfo;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
vec3 v_worldPos : TEXCOORD1 = vec3(0.0, 0.0, 0.0);
|
||||
vec3 v_view : TEXCOORD2 = vec3(0.0, 0.0, 0.0);
|
||||
vec3 v_position : TEXCOORD3 = vec3(0.0, 0.0, 0.0);
|
||||
vec3 v_normal : NORMAL = vec3(0.0, 0.0, 1.0);
|
||||
vec3 v_tangent : TANGENT = vec3(1.0, 0.0, 0.0);
|
||||
vec3 v_bitangent : BINORMAL = vec3(0.0, 1.0, 0.0);
|
||||
vec4 v_color0 : COLOR = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
|
||||
|
||||
vec3 a_position : POSITION;
|
||||
vec4 a_normal : NORMAL;
|
||||
vec4 a_tangent : TANGENT;
|
||||
vec2 a_texcoord0 : TEXCOORD0;
|
||||
vec4 a_color0 : COLOR0;
|
||||
vec4 i_data0 : TEXCOORD7;
|
||||
vec4 i_data1 : TEXCOORD6;
|
||||
vec4 i_data2 : TEXCOORD5;
|
||||
vec4 i_data3 : TEXCOORD4;
|
||||
vec4 i_data4 : TEXCOORD3;
|
||||
ivec4 a_indices : BLENDINDICES;
|
||||
vec4 a_weight : BLENDWEIGHT;
|
|
@ -0,0 +1,42 @@
|
|||
$input a_position, a_normal, a_tangent, a_color0
|
||||
$output v_worldPos, v_view, v_normal, v_tangent, v_bitangent, v_color0, v_position
|
||||
|
||||
/*
|
||||
* Portions of this file may have been directly taken or adapted from the following open sourced projects:
|
||||
*
|
||||
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
||||
*
|
||||
*/
|
||||
|
||||
#include <teverse.sh>
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 wpos = mul(u_model[0], vec4(a_position, 1.0) ).xyz;
|
||||
gl_Position = mul(u_viewProj, vec4(wpos, 1.0) );
|
||||
|
||||
vec4 normal = a_normal * 2.0 - 1.0;
|
||||
vec3 wnormal = mul(u_model[0], vec4(normal.xyz, 0.0) ).xyz;
|
||||
|
||||
vec4 tangent = a_tangent * 2.0 - 1.0;
|
||||
vec3 wtangent = mul(u_model[0], vec4(tangent.xyz, 0.0) ).xyz;
|
||||
|
||||
vec3 viewNormal = normalize(mul(u_view, vec4(wnormal, 0.0) ).xyz);
|
||||
vec3 viewTangent = normalize(mul(u_view, vec4(wtangent, 0.0) ).xyz);
|
||||
vec3 viewBitangent = cross(viewNormal, viewTangent) * tangent.w;
|
||||
mat3 tbn = mat3(viewTangent, viewBitangent, viewNormal);
|
||||
|
||||
v_worldPos = wpos;
|
||||
|
||||
vec3 view = mul(u_view, vec4(wpos, 0.0) ).xyz;
|
||||
v_view = mul(view, tbn);
|
||||
|
||||
v_normal = viewNormal;
|
||||
v_tangent = viewTangent;
|
||||
v_bitangent = viewBitangent;
|
||||
|
||||
v_position = a_position;
|
||||
|
||||
v_color0 = a_color0;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
$input v_color0
|
||||
|
||||
#include <teverse.sh>
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = v_color0;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
vec4 v_color0 : COLOR0 = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
vec3 a_position : POSITION;
|
||||
|
||||
vec4 a_color0 : COLOR0;
|
|
@ -1,10 +0,0 @@
|
|||
$input a_position, a_color0
|
||||
$output v_color0
|
||||
|
||||
#include <teverse.sh>
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0));
|
||||
v_color0 = a_color0;
|
||||
}
|
Loading…
Reference in New Issue