Update leenkx/Shaders/std/constants.glsl
This commit is contained in:
		@ -1,13 +1,16 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright (c) 2024 Turánszki János
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in
 | 
			
		||||
all copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 | 
			
		||||
@ -23,25 +26,34 @@ const float SHADOW_CONE_APERTURE = radians(15.0);
 | 
			
		||||
 | 
			
		||||
const float DIFFUSE_CONE_APERTURE = radians(50.0);
 | 
			
		||||
 | 
			
		||||
const vec3 DIFFUSE_CONE_DIRECTIONS[16] = vec3[](
 | 
			
		||||
    vec3( 0.0000,  0.0000,  1.0000),
 | 
			
		||||
    vec3( 0.7236,  0.5257,  0.4472),
 | 
			
		||||
    vec3(-0.2764,  0.8506,  0.4472),
 | 
			
		||||
    vec3(-0.8944,  0.0000,  0.4472),
 | 
			
		||||
    vec3(-0.2764, -0.8506,  0.4472),
 | 
			
		||||
    vec3( 0.7236, -0.5257,  0.4472),
 | 
			
		||||
    vec3( 0.7236,  0.5257, -0.4472),
 | 
			
		||||
    vec3(-0.2764,  0.8506, -0.4472),
 | 
			
		||||
    vec3(-0.8944,  0.0000, -0.4472),
 | 
			
		||||
    vec3(-0.2764, -0.8506, -0.4472),
 | 
			
		||||
    vec3( 0.7236, -0.5257, -0.4472),
 | 
			
		||||
    vec3( 0.2764,  0.8506,  0.4472),
 | 
			
		||||
    vec3(-0.7236,  0.5257,  0.4472),
 | 
			
		||||
    vec3(-0.7236, -0.5257,  0.4472),
 | 
			
		||||
    vec3( 0.2764, -0.8506,  0.4472),
 | 
			
		||||
    vec3( 0.0000,  0.0000, -1.0000)
 | 
			
		||||
const vec3 DIFFUSE_CONE_DIRECTIONS[DIFFUSE_CONE_COUNT] = vec3[](
 | 
			
		||||
    vec3(0.0, 0.0, 1.0), // center
 | 
			
		||||
 | 
			
		||||
    vec3(0.0, 0.5, 0.866),
 | 
			
		||||
    vec3(0.5, 0.0, 0.866),
 | 
			
		||||
    vec3(0.0, -0.5, 0.866),
 | 
			
		||||
    vec3(-0.5, 0.0, 0.866),
 | 
			
		||||
 | 
			
		||||
    vec3(0.353, 0.353, 0.866),
 | 
			
		||||
    vec3(0.353, -0.353, 0.866),
 | 
			
		||||
    vec3(-0.353, -0.353, 0.866),
 | 
			
		||||
    vec3(-0.353, 0.353, 0.866),
 | 
			
		||||
 | 
			
		||||
    vec3(0.707, 0.0, 0.707),
 | 
			
		||||
    vec3(0.0, 0.707, 0.707),
 | 
			
		||||
    vec3(-0.707, 0.0, 0.707),
 | 
			
		||||
    vec3(0.0, -0.707, 0.707),
 | 
			
		||||
 | 
			
		||||
    vec3(0.5, 0.5, 0.707),
 | 
			
		||||
    vec3(-0.5, 0.5, 0.707),
 | 
			
		||||
    vec3(-0.5, -0.5, 0.707)
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
mat3 makeTangentBasis(vec3 normal) {
 | 
			
		||||
    vec3 tangent = normalize(abs(normal.y) < 0.999 ? cross(normal, vec3(0, 1, 0)) : cross(normal, vec3(1, 0, 0)));
 | 
			
		||||
    vec3 bitangent = cross(normal, tangent);
 | 
			
		||||
    return mat3(tangent, bitangent, normal);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const float BayerMatrix8[8][8] =
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user