Added shader on placement. Added sound on drag (block placement sound).

Added line.
Highlight currently selected in radial menu (with colors).
Fixed scaling of icons.
Refactored RenderHandler into 3 classes and SurvivalHelper.
Added classes and icons for diagonal line, diagonal wall, slope floor and cube.
This commit is contained in:
Christian Knaapen
2019-02-08 03:26:41 +01:00
parent 73c55578e7
commit 009f385054
40 changed files with 1440 additions and 975 deletions

View File

@@ -9,4 +9,6 @@ item.effortlessbuilding:reach_upgrade1.name=Reach Upgrade 1
item.effortlessbuilding:reach_upgrade2.name=Reach Upgrade 2
item.effortlessbuilding:reach_upgrade3.name=Reach Upgrade 3
commands.reach.usage=/reach <level>
commands.reach.usage=/reach <level>
effortlessbuilding.subtitle.build_click=Click

View File

@@ -2,7 +2,7 @@
uniform int time; // Passed in, see ShaderHelper.java
uniform float percentile; // Passed in via Callback
uniform float dissolve; // Passed in via Callback
uniform int highlight;
uniform vec3 blockpos;
uniform vec3 firstpos;
@@ -44,28 +44,28 @@ void main() {
vec4 maskColor = texture2D(mask, maskcoord);
float maskgs = maskColor.r;
//color.rgb *= gl_Color.rgb;
color.rgb *= gl_Color.rgb;
//desaturate
color.rgb *= vec3(0.8);
//add blueish hue
color.rgb += vec3(-0.2, 0.0, 0.3);
color.rgb += vec3(-0.1, 0.0, 0.2);
//add pulsing blue
float pulse = (sin(time / 5.0) + 1.0) / 2.0;
color.rgb += (1.0 - color.rgb) * vec3(-0.5, 0.2, 0.6) * pulse;
color.rgb += 0.4 * vec3(-0.5, 0.2, 0.6) * pulse;
//add diagonal highlights
float diagTime = mod(time / 40.0, 1.4) - 0.2;
float diag = smoothstep(diagTime - 0.2, diagTime, place) - smoothstep(diagTime, diagTime + 0.2, place);
color.rgb += (1.0 - color.rgb) * diag * vec3(0.0, 0.2, 0.4);
color.rgb += 0.2 * diag * vec3(0.0, 0.2, 0.4);
float diagTime2 = mod(time / 70.0, 1.4) - 0.2;
float diag2 = smoothstep(diagTime2 - 0.2, diagTime2, place) - smoothstep(diagTime2, diagTime2 + 0.2, place);
color.rgb += (1.0 - color.rgb) * diag2 * vec3(0.0, 0.4, 0.8);
color.rgb += 0.2 * diag2 * vec3(0.0, 0.4, 0.8);
//add shading
//add edge shading
// vec3 p1;
// //if (firstpos.x < secondpos.x)
//
@@ -77,21 +77,16 @@ void main() {
// float distToEdge = min(min(distToEdge1, distToEdge2), distToEdge3);
// color.rgb += vec3(0.5 - smoothstep(0, 0.5, distToEdge)) * 0.5;
//add flat shading
if (abs(normal.x) > 0.5)
color.rgb -= 0.0;
if (abs(normal.y) > 0.5)
color.rgb += 0.05;
if (abs(normal.z) > 0.5)
color.rgb -= 0.05;
// pulse = 1.0;//pulse / 2.0 + 0.5;
// vec4 pulseColor = texture2D(mask, maskcoord + time / 700.0);
// vec4 pulseColor2 = texture2D(mask, vec2(maskcoord.x + time / 600.0, maskcoord.y - time / 600.0));
// float pulseGreyScale = pulseColor.r + pulseColor2.r / 2.0;
//
// color.r -= color.r * pulseColor.r * pulse * 0.2;
// color.g += (1.0 - color.g) * pulseColor.r * pulse * 0.2;
// color.b += (1.0 - color.b) * pulseColor.r * pulse * 0.8;
//
// color.r -= color.r * pulseColor2.r * pulse * 0.4;
// color.g += (1.0 - color.g) * pulseColor2.r * pulse * 0.2;
// color.b += (1.0 - color.b) * pulseColor2.r * pulse;
if(highlight == 1) {
if(highlight == 1 && dissolve == 0.0) {
color.r += 0.0;
color.g += 0.1;
color.b -= 0.2;
@@ -101,7 +96,7 @@ void main() {
color.g = max(0, min(1, color.g));
color.b = max(0, min(1, color.b));
if (maskgs * 0.3 + place * 0.7 <= percentile)
gl_FragColor = color;
else gl_FragColor = vec4(texcolor.rgb, 0.0);
if (maskgs * 0.3 + place * 0.7 <= dissolve)
gl_FragColor = vec4(texcolor.rgb, 0.0);
else gl_FragColor = color;
}

View File

@@ -2,7 +2,7 @@
uniform int time; // Passed in, see ShaderHelper.java
uniform float percentile; // Passed in via Callback
uniform float dissolve; // Passed in via Callback
uniform int highlight;
uniform vec3 blockpos;
uniform vec3 firstpos;
@@ -15,6 +15,8 @@ varying vec3 normal;
void main() {
gl_Position = ftransform();//gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_FrontColor = gl_Color;
gl_BackColor = gl_Color;
position = gl_Vertex;
normal = gl_Normal;

View File

@@ -0,0 +1,11 @@
{
"build_click": {
"category": "block",
"subtitle": "effortlessbuilding.subtitle.build_click",
"sounds": [
{
"name": "effortlessbuilding:build_click"
}
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 309 B