2024-05-05 16:07:28 -04:00
|
|
|
#version 120
|
|
|
|
#extension GL_ARB_explicit_attrib_location: enable
|
|
|
|
#extension GL_ARB_shader_image_load_store: enable
|
|
|
|
|
|
|
|
#include "/lib/settings.glsl"
|
|
|
|
|
|
|
|
#define RENDER_SHADOW
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
!! DO NOT REMOVE !!
|
|
|
|
This code is from Chocapic13' shaders
|
|
|
|
Read the terms of modification and sharing before changing something below please !
|
|
|
|
!! DO NOT REMOVE !!
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef IS_LPV_ENABLED
|
|
|
|
attribute vec4 mc_Entity;
|
|
|
|
attribute vec3 at_midBlock;
|
2024-05-05 17:47:37 -04:00
|
|
|
attribute vec3 vaPosition;
|
2024-05-05 16:07:28 -04:00
|
|
|
|
|
|
|
uniform int renderStage;
|
2024-05-05 17:47:37 -04:00
|
|
|
uniform vec3 chunkOffset;
|
|
|
|
uniform vec3 cameraPosition;
|
2024-05-05 16:07:28 -04:00
|
|
|
uniform int currentRenderedItemId;
|
|
|
|
uniform int blockEntityId;
|
|
|
|
uniform int entityId;
|
|
|
|
|
|
|
|
#include "/lib/blocks.glsl"
|
|
|
|
#include "/lib/entities.glsl"
|
|
|
|
#include "/lib/voxel_common.glsl"
|
|
|
|
#include "/lib/voxel_write.glsl"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
|
|
|
if (
|
|
|
|
renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT ||
|
|
|
|
renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT || renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT_MIPPED
|
|
|
|
) {
|
2024-05-05 17:47:37 -04:00
|
|
|
vec3 playerpos = gl_Vertex.xyz;
|
2024-05-05 16:07:28 -04:00
|
|
|
vec3 originPos = playerpos + at_midBlock/64.0;
|
|
|
|
|
2024-05-05 17:47:37 -04:00
|
|
|
uint voxelId = uint(mc_Entity.x + 0.5);
|
|
|
|
if (voxelId == 0u) voxelId = 1u;
|
|
|
|
|
2024-05-05 16:07:28 -04:00
|
|
|
SetVoxelBlock(originPos, voxelId);
|
|
|
|
}
|
|
|
|
|
2024-05-05 17:47:37 -04:00
|
|
|
// #ifdef LPV_ENTITY_LIGHTS
|
|
|
|
// if (
|
|
|
|
// (currentRenderedItemId > 0 || entityId > 0) &&
|
|
|
|
// (renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES || renderStage == MC_RENDER_STAGE_ENTITIES)
|
|
|
|
// ) {
|
|
|
|
// uint voxelId = 0u;
|
|
|
|
|
|
|
|
// if (currentRenderedItemId > 0) {
|
|
|
|
// if (entityId == ENTITY_PLAYER) {
|
|
|
|
// // TODO: remove once hand-light is added
|
|
|
|
// if (currentRenderedItemId < 1000)
|
|
|
|
// voxelId = uint(currentRenderedItemId);
|
|
|
|
// }
|
|
|
|
// else if (entityId != ENTITY_ITEM_FRAME)
|
|
|
|
// voxelId = uint(currentRenderedItemId);
|
|
|
|
// }
|
|
|
|
// else {
|
|
|
|
// switch (entityId) {
|
|
|
|
// case ENTITY_SPECTRAL_ARROW:
|
|
|
|
// voxelId = uint(BLOCK_TORCH);
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// // TODO: blaze, magma_cube
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (voxelId > 0u)
|
|
|
|
// SetVoxelBlock(playerpos, voxelId);
|
|
|
|
// }
|
|
|
|
// #endif
|
2024-05-05 16:07:28 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
gl_Position = vec4(-1.0);
|
2024-05-05 17:47:37 -04:00
|
|
|
}
|