summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-06-11 00:22:09 -0400
committerJoe Crayne <joe@jerkface.net>2019-06-11 00:22:09 -0400
commit6fddb0f2c9f60714089389350e001f6f765d2405 (patch)
treea21c2c389cdecc20aa55833d34a8e68d0bae7d69
parentb2f326bc7d7e1a7896b4b47e6c5fb5899c53aebf (diff)
Script to extract test data from OBJ spec.
-rw-r--r--doc/OBJ.spec100
-rwxr-xr-xtest-data/extract-data.sh10
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
915references the vertices stored immediately above it in the file. Note 915references the vertices stored immediately above it in the file. Note
916that vertices are not shared. 916that vertices are not shared.
917 917
918v 0.000000 2.000000 2.000000 918 v 0.000000 2.000000 2.000000
919v 0.000000 0.000000 2.000000 919 v 0.000000 0.000000 2.000000
920v 2.000000 0.000000 2.000000 920 v 2.000000 0.000000 2.000000
921v 2.000000 2.000000 2.000000 921 v 2.000000 2.000000 2.000000
922f -4 -3 -2 -1 922 f -4 -3 -2 -1
923 923
924v 2.000000 2.000000 0.000000 924 v 2.000000 2.000000 0.000000
925v 2.000000 0.000000 0.000000 925 v 2.000000 0.000000 0.000000
926v 0.000000 0.000000 0.000000 926 v 0.000000 0.000000 0.000000
927v 0.000000 2.000000 0.000000 927 v 0.000000 2.000000 0.000000
928f -4 -3 -2 -1 928 f -4 -3 -2 -1
929 929
930v 2.000000 2.000000 2.000000 930 v 2.000000 2.000000 2.000000
931v 2.000000 0.000000 2.000000 931 v 2.000000 0.000000 2.000000
932v 2.000000 0.000000 0.000000 932 v 2.000000 0.000000 0.000000
933v 2.000000 2.000000 0.000000 933 v 2.000000 2.000000 0.000000
934f -4 -3 -2 -1 934 f -4 -3 -2 -1
935 935
936v 0.000000 2.000000 0.000000 936 v 0.000000 2.000000 0.000000
937v 0.000000 2.000000 2.000000 937 v 0.000000 2.000000 2.000000
938v 2.000000 2.000000 2.000000 938 v 2.000000 2.000000 2.000000
939v 2.000000 2.000000 0.000000 939 v 2.000000 2.000000 0.000000
940f -4 -3 -2 -1 940 f -4 -3 -2 -1
941 941
942v 0.000000 2.000000 0.000000 942 v 0.000000 2.000000 0.000000
943v 0.000000 0.000000 0.000000 943 v 0.000000 0.000000 0.000000
944v 0.000000 0.000000 2.000000 944 v 0.000000 0.000000 2.000000
945v 0.000000 2.000000 2.000000 945 v 0.000000 2.000000 2.000000
946f -4 -3 -2 -1 946 f -4 -3 -2 -1
947 947
948v 0.000000 0.000000 2.000000 948 v 0.000000 0.000000 2.000000
949v 0.000000 0.000000 0.000000 949 v 0.000000 0.000000 0.000000
950v 2.000000 0.000000 0.000000 950 v 2.000000 0.000000 0.000000
951v 2.000000 0.000000 2.000000 951 v 2.000000 0.000000 2.000000
952f -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.
2358This example describes a 2 x 2 square. It is mapped with a 1 x 1 square 2358This example describes a 2 x 2 square. It is mapped with a 1 x 1 square
2359texture. The texture is stretched to fit the square exactly. 2359texture. The texture is stretched to fit the square exactly.
2360 2360
2361mtllib master.mtl 2361 mtllib master.mtl
2362 2362
2363v 0.000000 2.000000 0.000000 2363 v 0.000000 2.000000 0.000000
2364v 0.000000 0.000000 0.000000 2364 v 0.000000 0.000000 0.000000
2365v 2.000000 0.000000 0.000000 2365 v 2.000000 0.000000 0.000000
2366v 2.000000 2.000000 0.000000 2366 v 2.000000 2.000000 0.000000
2367vt 0.000000 1.000000 0.000000 2367 vt 0.000000 1.000000 0.000000
2368vt 0.000000 0.000000 0.000000 2368 vt 0.000000 0.000000 0.000000
2369vt 1.000000 0.000000 0.000000 2369 vt 1.000000 0.000000 0.000000
2370vt 1.000000 1.000000 0.000000 2370 vt 1.000000 1.000000 0.000000
2371# 4 vertices 2371 # 4 vertices
2372 2372
2373usemtl wood 2373 usemtl wood
2374f 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
23775. Approximation technique for a surface 23775. 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
5IFS='' read -r -d '' prog <<'EOF'
6BEGINFILE { 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"}}
9EOF
10awk "$prog" ../doc/OBJ.spec