Загрузчик двоичных ресурсов на сервере (Alpha)
This commit is contained in:
@@ -11,16 +11,20 @@ layout(location = 0) in GeometryObj {
|
||||
|
||||
layout(location = 0) out FragmentObj {
|
||||
vec3 GeoPos; // Реальная позиция в мире
|
||||
vec3 Normal;
|
||||
flat uint Texture; // Текстура
|
||||
vec2 UV;
|
||||
} Fragment;
|
||||
|
||||
void main() {
|
||||
vec3 normal = normalize(cross(Geometry[1].GeoPos-Geometry[0].GeoPos, Geometry[2].GeoPos-Geometry[0].GeoPos));
|
||||
|
||||
for(int iter = 0; iter < 3; iter++) {
|
||||
gl_Position = gl_in[iter].gl_Position;
|
||||
Fragment.GeoPos = Geometry[iter].GeoPos;
|
||||
Fragment.Texture = Geometry[iter].Texture;
|
||||
Fragment.UV = Geometry[iter].UV;
|
||||
Fragment.Normal = normal;
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
|
||||
layout(location = 0) in FragmentObj {
|
||||
vec3 GeoPos; // Реальная позиция в мире
|
||||
vec3 Normal;
|
||||
flat uint Texture; // Текстура
|
||||
vec2 UV;
|
||||
} Fragment;
|
||||
@@ -69,8 +70,21 @@ vec4 atlasColor(uint texId, vec2 uv)
|
||||
return color;
|
||||
}
|
||||
|
||||
vec3 blendOverlay(vec3 base, vec3 blend) {
|
||||
vec3 result;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (base[i] <= 0.5)
|
||||
result[i] = 2.0 * base[i] * blend[i];
|
||||
else
|
||||
result[i] = 1.0 - 2.0 * (1.0 - base[i]) * (1.0 - blend[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void main() {
|
||||
Frame = atlasColor(Fragment.Texture, Fragment.UV);
|
||||
Frame.xyz *= max(0.2f, dot(Fragment.Normal, normalize(vec3(0.5, 1, 0.8))));
|
||||
// Frame = vec4(blendOverlay(vec3(Frame), vec3(Fragment.GeoPos/64.f)), Frame.w);
|
||||
if(Frame.w == 0)
|
||||
discard;
|
||||
}
|
||||
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
|
||||
layout(location = 0) in FragmentObj {
|
||||
vec3 GeoPos; // Реальная позиция в мире
|
||||
vec3 Normal;
|
||||
flat uint Texture; // Текстура
|
||||
vec2 UV;
|
||||
} Fragment;
|
||||
|
||||
Binary file not shown.
BIN
assets/textures/acacia_planks.png
Normal file
BIN
assets/textures/acacia_planks.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB |
BIN
assets/textures/jungle_planks.png
Normal file
BIN
assets/textures/jungle_planks.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
assets/textures/oak_planks.png
Normal file
BIN
assets/textures/oak_planks.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Reference in New Issue
Block a user