Detect tile under foot

This commit is contained in:
2025-01-02 21:36:24 -06:00
parent 95b13a7f55
commit 4303aafb59
11 changed files with 84 additions and 54 deletions

View File

@@ -4,11 +4,10 @@ render_mode cull_disabled;
uniform sampler2D tileset : filter_nearest;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
vec4 textureColor = texture(tileset, UV);
vec4 textureColor = texture(tileset, UV) * COLOR;
if(textureColor.a == 0.0)
discard;

View File

@@ -7,27 +7,8 @@ uniform int direction;
const int FRAMES = 3;
const int DIRECTIONS = 4;
//const bool BILLBOARD_ROTATION_LOCK = false;
void vertex() {
//if(BILLBOARD_ROTATION_LOCK) {
//mat4 modified_model_view = VIEW_MATRIX * mat4(
//INV_VIEW_MATRIX[0],
//INV_VIEW_MATRIX[1],
//INV_VIEW_MATRIX[2],
//MODEL_MATRIX[3]
//);
//MODELVIEW_MATRIX = modified_model_view;
//} else {
//mat4 modified_model_view = VIEW_MATRIX * mat4(
//INV_VIEW_MATRIX[0],
//MODEL_MATRIX[1],
//MODEL_MATRIX[2],
//MODEL_MATRIX[3]
//);
//MODELVIEW_MATRIX = modified_model_view;
//}
vec2 tileSize = vec2(1.0 / float(FRAMES), 1.0 / float(DIRECTIONS));
vec2 topLeft = tileSize * vec2(float(frame % FRAMES), float(direction % DIRECTIONS));
vec2 bottomRight = topLeft + tileSize;