* Mini GPU overhaul

* Alch value

* Stoned Loot Tracker (persistent loot tracker)

* Checkstyle

* Added back max values to GPU plugin

* Persistent loot tracker config options

* Zulrah plugin type

* Add inventory highlight plugin

When dragging an item in the inventory, a highlight will show up to help
the player place the item in the correct slot, instead of missing when
they drag the item to the "gutter"

* Fix inventory highlight plugin

* Inventory highlight plugin type

* Inventory highlight config options

* Fix ess pouch swapping

* Runecraftig config options

* Add plugin type to persistient loot tracker

* Fix panel repaint

* Disable this for now

* Revert "Fix ess pouch swapping" -> PR #351

This reverts commit c18f65069f5df3a1cafb983af5b3e162817a22fe.

* I blame intellij for this

* Fix test
This commit is contained in:
sdburns1998
2019-05-21 21:56:07 +02:00
committed by Kyleeld
parent e9e0c51bd8
commit c18f13e2ab
58 changed files with 5334 additions and 243 deletions

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include to_screen.glsl
/*
* Rotate a vertex by a given orientation in JAU
*/
ivec4 rotate(ivec4 vertex, int orientation) {
ivec2 sinCos = sinCosTable[orientation];
int s = sinCos.x;
int c = sinCos.y;
int x = vertex.z * s + vertex.x * c >> 16;
int z = vertex.z * c - vertex.x * s >> 16;
return ivec4(x, vertex.y, z, vertex.w);
}
/*
* Calculate the distance to a vertex given the camera angle
*/
int distance(ivec4 vertex, int cameraYaw, int cameraPitch) {
int yawSin = int(65536.0f * sin(cameraYaw * UNIT));
int yawCos = int(65536.0f * cos(cameraYaw * UNIT));
int pitchSin = int(65536.0f * sin(cameraPitch * UNIT));
int pitchCos = int(65536.0f * cos(cameraPitch * UNIT));
int j = vertex.z * yawCos - vertex.x * yawSin >> 16;
int l = vertex.y * pitchSin + j * pitchCos >> 16;
return l;
}
/*
* Calculate the distance to a face
*/
int face_distance(ivec4 vA, ivec4 vB, ivec4 vC, int cameraYaw, int cameraPitch) {
int dvA = distance(vA, cameraYaw, cameraPitch);
int dvB = distance(vB, cameraYaw, cameraPitch);
int dvC = distance(vC, cameraYaw, cameraPitch);
int faceDistance = (dvA + dvB + dvC) / 3;
return faceDistance;
}
/*
* Test if a face is visible (not backward facing)
*/
bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) {
// Move model to scene location, and account for camera offset
ivec4 cameraPos = ivec4(cameraX, cameraY, cameraZ, 0);
vA += position - cameraPos;
vB += position - cameraPos;
vC += position - cameraPos;
ivec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0;
}

View File

@@ -37,7 +37,7 @@ shared int dfs[4096]; // packed face id and distance
layout(local_size_x = 1024) in;
#include common.glsl
#include common_func.glsl
#include priority_render.glsl
void main() {
@@ -100,4 +100,4 @@ void main() {
sort_and_insert(localId + 1, minfo, prio2Adj, dis2, vB1, vB2, vB3);
sort_and_insert(localId + 2, minfo, prio3Adj, dis3, vC1, vC2, vC3);
sort_and_insert(localId + 3, minfo, prio4Adj, dis4, vD1, vD2, vD3);
}
}

View File

@@ -37,7 +37,7 @@ shared int dfs[512]; // packed face id and distance
layout(local_size_x = 512) in;
#include common.glsl
#include common_func.glsl
#include priority_render.glsl
void main() {
@@ -78,4 +78,4 @@ void main() {
barrier();
sort_and_insert(localId, minfo, prio1Adj, dis1, vA1, vA2, vA3);
}
}

View File

@@ -29,7 +29,7 @@
layout(local_size_x = 6) in;
#include common.glsl
#include common_func.glsl
void main() {
uint groupId = gl_WorkGroupID.x;
@@ -86,4 +86,4 @@ void main() {
uvout[outOffset + myOffset * 3 + 1] = uv[uvOffset + localId * 3 + 1];
uvout[outOffset + myOffset * 3 + 2] = uv[uvOffset + localId * 3 + 2];
}
}
}

View File

@@ -64,6 +64,7 @@ int priority_map(int p, int distance, int _min10, int avg1, int avg2, int avg3)
default:
return -1;
}
return -1;
}
// calculate the number of faces with a lower adjusted priority than
@@ -108,6 +109,7 @@ int count_prio_offset(int priority) {
case 0:
return total;
}
return total;
}
void get_face(uint localId, modelinfo minfo, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom,
@@ -289,4 +291,4 @@ void sort_and_insert(uint localId, modelinfo minfo, int thisPriority, int thisDi
uvout[outOffset + myOffset * 3 + 2] = uv[uvOffset + localId * 3 + 2];
}
}
}
}

View File

@@ -47,7 +47,9 @@ layout(std140) uniform uniforms {
uniform float brightness;
uniform int useFog;
uniform int fogDepth;
uniform float fogDepth;
uniform float fogCornerRadius;
uniform float fogDensity;
uniform int drawDistance;
out ivec3 vPosition;
@@ -58,8 +60,27 @@ out float vFogAmount;
#include hsl_to_rgb.glsl
float fogFactorLinear(const float dist, const float start, const float end) {
return 1.0 - clamp((dist - start) / (end - start), 0.0, 1.0);
float fogFactorCurved(const float dist, const float start, const float end, const float accel) {
return 1.0 - pow(clamp((dist - start) / (end - start), 0.0, 1.0), accel);
}
// Returns the distance to the closest edge
float minEdgeDistance(vec3 v1, vec4 bounds){
return min(min(v1.x - bounds.x, bounds.y - v1.x), min(v1.z - bounds.z, bounds.w - v1.z));
}
float roundedRectangleFunction(vec3 v1, vec4 bounds, float cornerRadius){
float minXDistance = min(v1.x - bounds.x, bounds.y - v1.x);
float minZDistance = min(v1.z - bounds.z, bounds.w - v1.z);
if (minXDistance < cornerRadius && minZDistance < cornerRadius)
{
return cornerRadius - sqrt( pow(minXDistance - cornerRadius, 2) + pow(minZDistance - cornerRadius, 2) );
}
else
{
return min(minXDistance, minZDistance);
}
}
void main()
@@ -81,8 +102,6 @@ void main()
int fogSouth = max(FOG_SCENE_EDGE_MIN, cameraZ - drawDistance);
int fogNorth = min(FOG_SCENE_EDGE_MAX, cameraZ + drawDistance - TILE_SIZE);
// Calculate distance from the scene edge
float fogDistance = min(min(vertex.x - fogWest, fogEast - vertex.x), min(vertex.z - fogSouth, fogNorth - vertex.z));
vFogAmount = fogFactorLinear(fogDistance, 0, fogDepth * TILE_SIZE) * useFog;
}
float fogDistance = roundedRectangleFunction(vPosition, vec4(fogWest, fogEast, fogSouth, fogNorth), fogCornerRadius);
vFogAmount = fogFactorCurved(fogDistance, 0, fogDepth, fogDensity) * useFog;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B