List of commits:
Subject Hash Author Date (UTC)
Work on fgcLoadOBJ e1d3eb6f3b0d009a30d1f2931f9d548cc8d14967 fluffrabbit 2024-09-14 06:37:16
Add fgcNormalizeVertices 7d7dfbf70275dc5cd3529e3755a2301ba06cb6fe fluffrabbit 2024-09-10 01:44:33
Draw scene color 12354112add161591f2801600ffc592faddef502 fluffrabbit 2024-07-11 22:18:26
Put framebuffer textures in an array ad44ec442db02cbb194559948d7183580b488cec fluffrabbit 2024-07-11 19:33:58
Initial commit cd1f3278f6f9a79255ba17b3b9eb0c224c8fd091 fluffrabbit 2024-07-10 17:32:30
Commit e1d3eb6f3b0d009a30d1f2931f9d548cc8d14967 - Work on fgcLoadOBJ
Author: fluffrabbit
Author date (UTC): 2024-09-14 06:37
Committer name: fluffrabbit
Committer date (UTC): 2024-09-14 06:37
Parent(s): 7d7dfbf70275dc5cd3529e3755a2301ba06cb6fe
Signer:
Signing key:
Signing status: N
Tree: bc62b6b3557fbab7649d7b8de64bc6861e6f871a
File Lines added Lines deleted
include/fgc.h 39 2
File include/fgc.h changed (mode: 100644) (index f3608b6..9af3514)
... ... FGCMesh fgcLoadOBJ( const char* filePath ){
1010 1010 // Read the file, one line at a time. // Read the file, one line at a time.
1011 1011 while( fgets( ln, sizeof(ln), file ) ){ while( fgets( ln, sizeof(ln), file ) ){
1012 1012 if( ln[0] && ln[0] != '#' ){ if( ln[0] && ln[0] != '#' ){
1013 // TODO.
1014 // { strtof( str, str_end ), strtof( str, str_end ), strtof( str, str_end ) }
1013 size_t len = strlen( ln );
1014 // Strip away new line characters.
1015 for( int i = 0; i < 2; i++ ){
1016 if(len > 0 && (ln[len - 1] == '\r' || ln[len - 1] == '\n')){
1017 len--;
1018 }
1019 }
1020 // Determine the type of element.
1021 int type = 0;
1022 if( len > 5 && ln[0] == 'v' && ln[1] == '\x20' ){
1023 type = 1;
1024 }else if( len > 5 && ln[0] == 'v' && ln[1] == 't' ){
1025 type = 2;
1026 }else if( len > 5 && ln[0] == 'v' && ln[1] == 'n' ){
1027 type = 3;
1028 }else if( len > 5 && ln[0] == 'f' && ln[1] == '\x20' ){
1029 type = 4;
1030 }
1031 if( type > 0 ){
1032 // Start at the first non-space character.
1033 size_t start = 2;
1034 while( start < len && ln[start] == '\x20' ){
1035 start++;
1036 }
1037 // Parse the line.
1038 for( size_t i = start; i <= len; i++ ){
1039 size_t num_len = i - start;
1040 char num_str[32];
1041 if((i == len || ln[i] == '\x20' || ln[i] == '/') && num_len < sizeof(num_str)){
1042 memcpy( num_str, ln + start, num_len );
1043 // Null-terminate the string for strtof.
1044 num_str[num_len] = '\0';
1045 // Note: strtof is locale-dependent. Set locale in main()
1046 // TODO.
1047 //{strtof(str, str_end), strtof(str, str_end), strtof(str, str_end)}
1048 start = i + 1;
1049 }
1050 }
1051 }
1015 1052 } }
1016 1053 } }
1017 1054
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/fluffrabbit/cfps

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/fluffrabbit/cfps

Clone this repository using git:
git clone git://git.rocketgit.com/user/fluffrabbit/cfps

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main