| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 import optparse | 2 import optparse |
| 3 import os | 3 import os |
| 4 import re | 4 import re |
| 5 import subprocess | 5 import subprocess |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 # This script takes an o3d cg shader from standard input and does the following: | 8 # This script takes an o3d cg shader from standard input and does the following: |
| 9 # | 9 # |
| 10 # * it extracts entry points to vertex and fragment shaders as specified by | 10 # * it extracts entry points to vertex and fragment shaders as specified by |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 # Cygwin lies about the OS name ("posix" instead of "nt"), the line | 27 # Cygwin lies about the OS name ("posix" instead of "nt"), the line |
| 28 # separator, and perhaps other things. For most robust behavior, try | 28 # separator, and perhaps other things. For most robust behavior, try |
| 29 # to find cgc on disk. | 29 # to find cgc on disk. |
| 30 | 30 |
| 31 CGC = '/usr/bin/cgc' | 31 CGC = '/usr/bin/cgc' |
| 32 if not os.path.exists(CGC): | 32 if not os.path.exists(CGC): |
| 33 CGC = 'c:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cgc.exe' | 33 CGC = 'c:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cgc.exe' |
| 34 if not os.path.exists(CGC): | 34 if not os.path.exists(CGC): |
| 35 CGC = 'c:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cgc.exe' | 35 CGC = 'c:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cgc.exe' |
| 36 if not os.path.exists(CGC): |
| 37 script_path = os.path.abspath(sys.path[0]) |
| 38 # Try again looking in the current working directory to match |
| 39 # the layout of the prebuilt o3dConverter binaries. |
| 40 CGC = os.path.join(script_path, 'cgc') |
| 41 if not os.path.exists(CGC): |
| 42 CGC = os.path.join(script_path, 'cgc.exe') |
| 36 | 43 |
| 37 # cgc complains about TANGENT1 and BINORMAL1 semantics, so we hack it by | 44 # cgc complains about TANGENT1 and BINORMAL1 semantics, so we hack it by |
| 38 # replacing standard semantics with ATTR8-ATTR12 and then renaming them back to | 45 # replacing standard semantics with ATTR8-ATTR12 and then renaming them back to |
| 39 # their original names. | 46 # their original names. |
| 40 ATTRIBUTES_TO_SEMANTICS = dict( | 47 ATTRIBUTES_TO_SEMANTICS = dict( |
| 41 attr8 = 'normal', | 48 attr8 = 'normal', |
| 42 attr9 = 'tangent', | 49 attr9 = 'tangent', |
| 43 attr10 = 'binormal', | 50 attr10 = 'binormal', |
| 44 attr11 = 'tangent1', | 51 attr11 = 'tangent1', |
| 45 attr12 = 'binormal1') | 52 attr12 = 'binormal1') |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 else: | 239 else: |
| 233 f = open(options.file) | 240 f = open(options.file) |
| 234 input = f.read() | 241 input = f.read() |
| 235 except KeyboardInterrupt: | 242 except KeyboardInterrupt: |
| 236 input = None | 243 input = None |
| 237 | 244 |
| 238 if not input: | 245 if not input: |
| 239 cmdline_parser.print_help() | 246 cmdline_parser.print_help() |
| 240 else: | 247 else: |
| 241 main(input) | 248 main(input) |
| OLD | NEW |