diff options
author | Joe Crayne <joe@jerkface.net> | 2019-06-11 00:22:09 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-06-11 00:22:09 -0400 |
commit | 6fddb0f2c9f60714089389350e001f6f765d2405 (patch) | |
tree | a21c2c389cdecc20aa55833d34a8e68d0bae7d69 | |
parent | b2f326bc7d7e1a7896b4b47e6c5fb5899c53aebf (diff) |
Script to extract test data from OBJ spec.
-rw-r--r-- | doc/OBJ.spec | 100 | ||||
-rwxr-xr-x | test-data/extract-data.sh | 10 |
2 files changed, 60 insertions, 50 deletions
diff --git a/doc/OBJ.spec b/doc/OBJ.spec index 09b6e72..13f49a5 100644 --- a/doc/OBJ.spec +++ b/doc/OBJ.spec | |||
@@ -915,41 +915,41 @@ This is a cube with negative vertex reference numbers. Each element | |||
915 | references the vertices stored immediately above it in the file. Note | 915 | references the vertices stored immediately above it in the file. Note |
916 | that vertices are not shared. | 916 | that vertices are not shared. |
917 | 917 | ||
918 | v 0.000000 2.000000 2.000000 | 918 | v 0.000000 2.000000 2.000000 |
919 | v 0.000000 0.000000 2.000000 | 919 | v 0.000000 0.000000 2.000000 |
920 | v 2.000000 0.000000 2.000000 | 920 | v 2.000000 0.000000 2.000000 |
921 | v 2.000000 2.000000 2.000000 | 921 | v 2.000000 2.000000 2.000000 |
922 | f -4 -3 -2 -1 | 922 | f -4 -3 -2 -1 |
923 | 923 | ||
924 | v 2.000000 2.000000 0.000000 | 924 | v 2.000000 2.000000 0.000000 |
925 | v 2.000000 0.000000 0.000000 | 925 | v 2.000000 0.000000 0.000000 |
926 | v 0.000000 0.000000 0.000000 | 926 | v 0.000000 0.000000 0.000000 |
927 | v 0.000000 2.000000 0.000000 | 927 | v 0.000000 2.000000 0.000000 |
928 | f -4 -3 -2 -1 | 928 | f -4 -3 -2 -1 |
929 | 929 | ||
930 | v 2.000000 2.000000 2.000000 | 930 | v 2.000000 2.000000 2.000000 |
931 | v 2.000000 0.000000 2.000000 | 931 | v 2.000000 0.000000 2.000000 |
932 | v 2.000000 0.000000 0.000000 | 932 | v 2.000000 0.000000 0.000000 |
933 | v 2.000000 2.000000 0.000000 | 933 | v 2.000000 2.000000 0.000000 |
934 | f -4 -3 -2 -1 | 934 | f -4 -3 -2 -1 |
935 | 935 | ||
936 | v 0.000000 2.000000 0.000000 | 936 | v 0.000000 2.000000 0.000000 |
937 | v 0.000000 2.000000 2.000000 | 937 | v 0.000000 2.000000 2.000000 |
938 | v 2.000000 2.000000 2.000000 | 938 | v 2.000000 2.000000 2.000000 |
939 | v 2.000000 2.000000 0.000000 | 939 | v 2.000000 2.000000 0.000000 |
940 | f -4 -3 -2 -1 | 940 | f -4 -3 -2 -1 |
941 | 941 | ||
942 | v 0.000000 2.000000 0.000000 | 942 | v 0.000000 2.000000 0.000000 |
943 | v 0.000000 0.000000 0.000000 | 943 | v 0.000000 0.000000 0.000000 |
944 | v 0.000000 0.000000 2.000000 | 944 | v 0.000000 0.000000 2.000000 |
945 | v 0.000000 2.000000 2.000000 | 945 | v 0.000000 2.000000 2.000000 |
946 | f -4 -3 -2 -1 | 946 | f -4 -3 -2 -1 |
947 | 947 | ||
948 | v 0.000000 0.000000 2.000000 | 948 | v 0.000000 0.000000 2.000000 |
949 | v 0.000000 0.000000 0.000000 | 949 | v 0.000000 0.000000 0.000000 |
950 | v 2.000000 0.000000 0.000000 | 950 | v 2.000000 0.000000 0.000000 |
951 | v 2.000000 0.000000 2.000000 | 951 | v 2.000000 0.000000 2.000000 |
952 | f -4 -3 -2 -1 | 952 | f -4 -3 -2 -1 |
953 | 953 | ||
954 | 954 | ||
955 | 955 | ||
@@ -2358,21 +2358,21 @@ references itself as the trace object. | |||
2358 | This example describes a 2 x 2 square. It is mapped with a 1 x 1 square | 2358 | This example describes a 2 x 2 square. It is mapped with a 1 x 1 square |
2359 | texture. The texture is stretched to fit the square exactly. | 2359 | texture. The texture is stretched to fit the square exactly. |
2360 | 2360 | ||
2361 | mtllib master.mtl | 2361 | mtllib master.mtl |
2362 | 2362 | ||
2363 | v 0.000000 2.000000 0.000000 | 2363 | v 0.000000 2.000000 0.000000 |
2364 | v 0.000000 0.000000 0.000000 | 2364 | v 0.000000 0.000000 0.000000 |
2365 | v 2.000000 0.000000 0.000000 | 2365 | v 2.000000 0.000000 0.000000 |
2366 | v 2.000000 2.000000 0.000000 | 2366 | v 2.000000 2.000000 0.000000 |
2367 | vt 0.000000 1.000000 0.000000 | 2367 | vt 0.000000 1.000000 0.000000 |
2368 | vt 0.000000 0.000000 0.000000 | 2368 | vt 0.000000 0.000000 0.000000 |
2369 | vt 1.000000 0.000000 0.000000 | 2369 | vt 1.000000 0.000000 0.000000 |
2370 | vt 1.000000 1.000000 0.000000 | 2370 | vt 1.000000 1.000000 0.000000 |
2371 | # 4 vertices | 2371 | # 4 vertices |
2372 | 2372 | ||
2373 | usemtl wood | 2373 | usemtl wood |
2374 | f 1/1 2/2 3/3 4/4 | 2374 | f 1/1 2/2 3/3 4/4 |
2375 | # 1 element | 2375 | # 1 element |
2376 | 2376 | ||
2377 | 5. Approximation technique for a surface | 2377 | 5. Approximation technique for a surface |
2378 | 2378 | ||
diff --git a/test-data/extract-data.sh b/test-data/extract-data.sh new file mode 100755 index 0000000..a0e5af8 --- /dev/null +++ b/test-data/extract-data.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # This script extracts examples from OBJ.spec for testing purposes. | ||
4 | |||
5 | IFS='' read -r -d '' prog <<'EOF' | ||
6 | BEGINFILE { g=0; } | ||
7 | /^ (v[tnp]? [^is]|#|mtllib\b|g\b)/ {if(!inside){ g++; inside=1; }} | ||
8 | /^[^ ]/{inside=0;} { if(inside) {print $0 > sprintf("%02d",g) ".obj"}} | ||
9 | EOF | ||
10 | awk "$prog" ../doc/OBJ.spec | ||