This commit is contained in:
Your Name
2024-10-17 17:58:55 -06:00
parent 3137c23479
commit fda999bfb1
4 changed files with 51 additions and 26 deletions

16
src/main.c Normal file → Executable file
View File

@@ -29,15 +29,17 @@ void calc_normal(float* v1, float* v2, float* v3, float* normal)
void fill_normal( float * d, float * n )
{
*n = *d;
//*n = *d;
for (int i = 0; i < *d; i += 9)
{
vec3 norm_vec;
calc_normal((d+1)+i, (d+1)+i+3, (d+1)+i+6, norm_vec);
glm_vec3_copy( norm_vec, (n+1)+i );
glm_vec3_copy( norm_vec, (n+1)+i+3 );
glm_vec3_copy( norm_vec, (n+1)+i+6 );
glm_vec3_copy( norm_vec, (n+1)+i );
glm_vec3_copy( norm_vec, (n+1)+i+3 );
glm_vec3_copy( norm_vec, (n+1)+i+6 );
}
}
@@ -57,15 +59,15 @@ int main( void )
glewInit();
fill_normal( d_cube, n_cube );
fill_normal( d_cube, d_cube+(int)*d_cube);
if( !( shader = create_shader() ) )
goto error_shader;
gload_program( shader, vs, VERTEX );
gload_program( shader, fs, FRAGMENT );
use_shader( shader );
use_shader( shader );
load_fix_matrix( shader, (float)WIDTH/HEIGHT );