aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-04-16 16:57:56 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-04-16 16:57:56 +0000
commitf0a0118393a3d121bcb83047b5b9ac95eb0621ba (patch)
treecfc4f3f7955b4829317fa9b7865e328ccabfb129
Initial import
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@1 84d2e878-0bd5-11dd-ad15-13eda11d74c5
-rw-r--r--AUTHORS2
-rw-r--r--COPYING340
-rw-r--r--ChangeLog0
-rw-r--r--INSTALL236
-rw-r--r--Makefile.am3
-rw-r--r--NEWS0
-rw-r--r--README0
-rw-r--r--configure.ac62
-rw-r--r--data/Makefile.am13
-rw-r--r--data/models/ceiling9
-rw-r--r--data/models/floor9
-rw-r--r--data/models/lander348
-rw-r--r--data/models/lander.obj1863
-rw-r--r--data/models/platform30
-rw-r--r--data/models/randombox30
-rw-r--r--data/models/tiledfloor9
-rw-r--r--data/models/walle9
-rw-r--r--data/models/walln9
-rw-r--r--data/models/walls9
-rw-r--r--data/models/wallw9
-rw-r--r--data/rooms/00-00-0020
-rw-r--r--data/rooms/00-00-0112
-rw-r--r--data/rooms/00-00-0212
-rw-r--r--data/rooms/00-00-0314
-rw-r--r--data/rooms/00-00-0414
-rw-r--r--data/rooms/00-01-0414
-rw-r--r--data/rooms/00-02-0412
-rw-r--r--data/shaders/lighting.frag53
-rw-r--r--data/shaders/lighting.vert39
-rw-r--r--data/textures/floor1.pngbin0 -> 197431 bytes
-rw-r--r--data/textures/tiledwall.pngbin0 -> 12099 bytes
-rwxr-xr-xdepcomp530
-rwxr-xr-xinstall-sh323
-rwxr-xr-xmissing360
-rw-r--r--modelling/lander.blendbin0 -> 152264 bytes
-rw-r--r--modelling/lander.blend.mtl2
-rw-r--r--modelling/lander.blend.obj27
-rw-r--r--modelling/lander.blend1bin0 -> 152264 bytes
-rw-r--r--modelling/lander.old348
-rwxr-xr-xscripts/model.pl26
-rw-r--r--src/Makefile.am6
-rw-r--r--src/game.c357
-rw-r--r--src/game.h29
-rw-r--r--src/main.c98
-rw-r--r--src/model.c399
-rw-r--r--src/model.h25
-rw-r--r--src/physics.c148
-rw-r--r--src/physics.h24
-rw-r--r--src/render.c333
-rw-r--r--src/render.h26
-rw-r--r--src/texture.c180
-rw-r--r--src/texture.h26
-rw-r--r--src/types.h174
-rw-r--r--src/utils.c30
-rw-r--r--src/utils.h27
55 files changed, 6678 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..99ac065
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Thomas White <taw27@srcf.ucam.org>
+
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..623b625
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..23e5f25
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,236 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script). Here is a another example:
+
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..c463e58
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,3 @@
+EXTRA_DIST = configure src/game.h src/model.h src/physics.h src/render.h src/texture.h src/types.h src/utils.h data/*
+SUBDIRS = src data
+
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/README
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..6e69b59
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,62 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(thrust3d, 0.0.1, taw27@cam.ac.uk)
+VERSION=AC_PACKAGE_VERSION
+
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(thrust3d, "$VERSION")
+
+AC_PROG_CC
+AC_PROG_AWK
+AC_PROG_INSTALL
+AC_PROG_LN_S
+
+AC_HEADER_STDC
+AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
+AC_C_CONST
+AC_FUNC_MALLOC
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS([strdup])
+
+if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+fi
+if test "$PKG_CONFIG" = "no" ; then
+ echo "*** pkg-config not found. Do you have pkg-config installed?"
+fi
+
+AC_MSG_CHECKING([SDL])
+if $PKG_CONFIG sdl ; then
+ LIBSDL_CFLAGS=`$PKG_CONFIG --cflags sdl`
+ LIBSDL_LIBS=`$PKG_CONFIG --libs sdl`
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([
+*** SDL not found. Do you have 'libsdl-dev' or similar installed?])
+fi
+
+AC_CHECK_LIB(GL, main, [OPENGL_CFLAGS=-I/usr/include/GL
+OPENGL_LIBS=-lGL], AC_MSG_ERROR([
+*** OpenGL not found. Do you have 'libgl-dev' or similar installed?]))
+
+AC_CHECK_LIB(GLU, main, [GLU_LIBS=-lGLU], AC_MSG_ERROR([
+*** GLU not found. Do you have 'libglu-dev' or similar installed?]))
+
+AC_MSG_CHECKING([libpng])
+if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then
+ LIBPNG_VERSION=`$PKG_CONFIG --modversion libpng`
+ AC_MSG_RESULT($LIBPNG_VERSION)
+ LIBPNG_CFLAGS=`$PKG_CONFIG --cflags libpng`
+ LIBPNG_LIBS=`$PKG_CONFIG --libs libpng`
+else
+ AC_MSG_RESULT([Lower than 1.2.0 or not found])
+ AC_MSG_ERROR([
+*** libPNG not found. Do you have 'libpng-dev' or similar installed?])
+fi
+
+CFLAGS="$CFLAGS $LIBSDL_CFLAGS $OPENGL_CFLAGS $LIBPNG_CFLAGS"
+LIBS="$LIBS $LIBSDL_LIBS $OPENGL_LIBS $GLU_LIBS $LIBPNG_LIBS"
+
+AC_OUTPUT(Makefile src/Makefile data/Makefile)
+
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..beb1463
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,13 @@
+modelsdir = $(datadir)/thrust3d/models
+models_DATA = models/floor models/lander.obj models/randombox models/walle models/walln models/wallw models/walls models/platform \
+ models/ceiling models/tiledfloor
+
+shadersdir = $(datadir)/thrust3d/shaders
+shaders_DATA = shaders/lighting.vert shaders/lighting.frag
+
+texturesdir = $(datadir)/thrust3d/textures
+textures_DATA = textures/floor1.png textures/tiledwall.png
+
+roomsdir = $(datadir)/thrust3d/rooms
+rooms_DATA = rooms/00-00-00 rooms/00-00-01 rooms/00-00-02 rooms/00-00-03 rooms/00-00-04 rooms/00-01-04 rooms/00-02-04
+
diff --git a/data/models/ceiling b/data/models/ceiling
new file mode 100644
index 0000000..339fd26
--- /dev/null
+++ b/data/models/ceiling
@@ -0,0 +1,9 @@
+# Ceiling
+
+QUADS
+texture tiledwall
+ 5.0 5.0 0.0 1.0 1.0
+ 5.0 -5.0 0.0 0.0 1.0
+-5.0 -5.0 0.0 0.0 0.0
+-5.0 5.0 0.0 1.0 0.0
+
diff --git a/data/models/floor b/data/models/floor
new file mode 100644
index 0000000..0eb18b1
--- /dev/null
+++ b/data/models/floor
@@ -0,0 +1,9 @@
+# Floor
+
+QUADS
+texture floor1
+-5.0 -5.0 0.0 0.0 0.0
+ 5.0 -5.0 0.0 1.0 0.0
+ 5.0 5.0 0.0 1.0 1.0
+-5.0 5.0 0.0 0.0 1.0
+
diff --git a/data/models/lander b/data/models/lander
new file mode 100644
index 0000000..56b6532
--- /dev/null
+++ b/data/models/lander
@@ -0,0 +1,348 @@
+# Moon lander spacecraft thingy
+
+QUADS
+colour 0.0 0.5 0.2
+# Lower left foot
+ -0.25 -0.30 0.05
+ -0.25 -0.30 0.00
+ -0.15 -0.30 0.00
+ -0.15 -0.30 0.05
+ -0.15 -0.30 0.05
+ -0.15 -0.30 0.00
+ -0.10 -0.25 0.00
+ -0.10 -0.25 0.05
+ -0.10 -0.25 0.05
+ -0.10 -0.25 0.00
+ -0.10 -0.15 0.00
+ -0.10 -0.15 0.05
+ -0.10 -0.15 0.05
+ -0.10 -0.15 0.00
+ -0.15 -0.10 0.00
+ -0.15 -0.10 0.05
+ -0.15 -0.10 0.05
+ -0.15 -0.10 0.00
+ -0.25 -0.10 0.00
+ -0.25 -0.10 0.05
+ -0.25 -0.10 0.05
+ -0.25 -0.10 0.00
+ -0.30 -0.15 0.00
+ -0.30 -0.15 0.05
+ -0.30 -0.15 0.05
+ -0.30 -0.15 0.00
+ -0.30 -0.25 0.00
+ -0.30 -0.25 0.05
+ -0.30 -0.25 0.05
+ -0.30 -0.25 0.00
+ -0.25 -0.30 0.00
+ -0.25 -0.30 0.05
+# Lower right foot
+ 0.25 -0.30 0.00
+ 0.25 -0.30 0.05
+ 0.15 -0.30 0.05
+ 0.15 -0.30 0.00
+ 0.15 -0.30 0.00
+ 0.15 -0.30 0.05
+ 0.10 -0.25 0.05
+ 0.10 -0.25 0.00
+ 0.10 -0.25 0.00
+ 0.10 -0.25 0.05
+ 0.10 -0.15 0.05
+ 0.10 -0.15 0.00
+ 0.10 -0.15 0.00
+ 0.10 -0.15 0.05
+ 0.15 -0.10 0.05
+ 0.15 -0.10 0.00
+ 0.15 -0.10 0.00
+ 0.15 -0.10 0.05
+ 0.25 -0.10 0.05
+ 0.25 -0.10 0.00
+ 0.25 -0.10 0.00
+ 0.25 -0.10 0.05
+ 0.30 -0.15 0.05
+ 0.30 -0.15 0.00
+ 0.30 -0.15 0.00
+ 0.30 -0.15 0.05
+ 0.30 -0.25 0.05
+ 0.30 -0.25 0.00
+ 0.30 -0.25 0.00
+ 0.30 -0.25 0.05
+ 0.25 -0.30 0.05
+ 0.25 -0.30 0.00
+# Upper left foot
+ -0.25 0.30 0.00
+ -0.25 0.30 0.05
+ -0.15 0.30 0.05
+ -0.15 0.30 0.00
+ -0.15 0.30 0.00
+ -0.15 0.30 0.05
+ -0.10 0.25 0.05
+ -0.10 0.25 0.00
+ -0.10 0.25 0.00
+ -0.10 0.25 0.05
+ -0.10 0.15 0.05
+ -0.10 0.15 0.00
+ -0.10 0.15 0.00
+ -0.10 0.15 0.05
+ -0.15 0.10 0.05
+ -0.15 0.10 0.00
+ -0.15 0.10 0.00
+ -0.15 0.10 0.05
+ -0.25 0.10 0.05
+ -0.25 0.10 0.00
+ -0.25 0.10 0.00
+ -0.25 0.10 0.05
+ -0.30 0.15 0.05
+ -0.30 0.15 0.00
+ -0.30 0.15 0.00
+ -0.30 0.15 0.05
+ -0.30 0.25 0.05
+ -0.30 0.25 0.00
+ -0.30 0.25 0.00
+ -0.30 0.25 0.05
+ -0.25 0.30 0.05
+ -0.25 0.30 0.00
+# Upper right foot
+ 0.25 0.30 0.05
+ 0.25 0.30 0.00
+ 0.15 0.30 0.00
+ 0.15 0.30 0.05
+ 0.15 0.30 0.05
+ 0.15 0.30 0.00
+ 0.10 0.25 0.00
+ 0.10 0.25 0.05
+ 0.10 0.25 0.05
+ 0.10 0.25 0.00
+ 0.10 0.15 0.00
+ 0.10 0.15 0.05
+ 0.10 0.15 0.05
+ 0.10 0.15 0.00
+ 0.15 0.10 0.00
+ 0.15 0.10 0.05
+ 0.15 0.10 0.05
+ 0.15 0.10 0.00
+ 0.25 0.10 0.00
+ 0.25 0.10 0.05
+ 0.25 0.10 0.05
+ 0.25 0.10 0.00
+ 0.30 0.15 0.00
+ 0.30 0.15 0.05
+ 0.30 0.15 0.05
+ 0.30 0.15 0.00
+ 0.30 0.25 0.00
+ 0.30 0.25 0.05
+ 0.30 0.25 0.05
+ 0.30 0.25 0.00
+ 0.25 0.30 0.00
+ 0.25 0.30 0.05
+
+TRIANGLES
+colour 0.0 0.5 0.2
+# Upper right foot, bottom panel
+ 0.20 0.20 0.00
+ 0.25 0.10 0.00
+ 0.15 0.10 0.00
+ 0.20 0.20 0.00
+ 0.15 0.10 0.00
+ 0.10 0.15 0.00
+ 0.20 0.20 0.00
+ 0.10 0.15 0.00
+ 0.10 0.25 0.00
+ 0.20 0.20 0.00
+ 0.10 0.25 0.00
+ 0.15 0.30 0.00
+ 0.20 0.20 0.00
+ 0.15 0.30 0.00
+ 0.25 0.30 0.00
+ 0.20 0.20 0.00
+ 0.25 0.30 0.00
+ 0.30 0.25 0.00
+ 0.20 0.20 0.00
+ 0.30 0.25 0.00
+ 0.30 0.15 0.00
+ 0.20 0.20 0.00
+ 0.30 0.15 0.00
+ 0.25 0.10 0.00
+# Upper left foot, bottom panel
+ -0.20 0.20 0.00
+ -0.15 0.10 0.00
+ -0.25 0.10 0.00
+ -0.20 0.20 0.00
+ -0.10 0.15 0.00
+ -0.15 0.10 0.00
+ -0.20 0.20 0.00
+ -0.10 0.25 0.00
+ -0.10 0.15 0.00
+ -0.20 0.20 0.00
+ -0.15 0.30 0.00
+ -0.10 0.25 0.00
+ -0.20 0.20 0.00
+ -0.25 0.30 0.00
+ -0.15 0.30 0.00
+ -0.20 0.20 0.00
+ -0.30 0.25 0.00
+ -0.25 0.30 0.00
+ -0.20 0.20 0.00
+ -0.30 0.15 0.00
+ -0.30 0.25 0.00
+ -0.20 0.20 0.00
+ -0.25 0.10 0.00
+ -0.30 0.15 0.00
+# Lower left foot, bottom panel
+ -0.20 -0.20 0.00
+ -0.25 -0.10 0.00
+ -0.15 -0.10 0.00
+ -0.20 -0.20 0.00
+ -0.15 -0.10 0.00
+ -0.10 -0.15 0.00
+ -0.20 -0.20 0.00
+ -0.10 -0.15 0.00
+ -0.10 -0.25 0.00
+ -0.20 -0.20 0.00
+ -0.10 -0.25 0.00
+ -0.15 -0.30 0.00
+ -0.20 -0.20 0.00
+ -0.15 -0.30 0.00
+ -0.25 -0.30 0.00
+ -0.20 -0.20 0.00
+ -0.25 -0.30 0.00
+ -0.30 -0.25 0.00
+ -0.20 -0.20 0.00
+ -0.30 -0.25 0.00
+ -0.30 -0.15 0.00
+ -0.20 -0.20 0.00
+ -0.30 -0.15 0.00
+ -0.25 -0.10 0.00
+# Lower right foot, bottom panel
+ 0.20 -0.20 0.00
+ 0.15 -0.10 0.00
+ 0.25 -0.10 0.00
+ 0.20 -0.20 0.00
+ 0.10 -0.15 0.00
+ 0.15 -0.10 0.00
+ 0.20 -0.20 0.00
+ 0.10 -0.25 0.00
+ 0.10 -0.15 0.00
+ 0.20 -0.20 0.00
+ 0.15 -0.30 0.00
+ 0.10 -0.25 0.00
+ 0.20 -0.20 0.00
+ 0.25 -0.30 0.00
+ 0.15 -0.30 0.00
+ 0.20 -0.20 0.00
+ 0.30 -0.25 0.00
+ 0.25 -0.30 0.00
+ 0.20 -0.20 0.00
+ 0.30 -0.15 0.00
+ 0.30 -0.25 0.00
+ 0.20 -0.20 0.00
+ 0.25 -0.10 0.00
+ 0.30 -0.15 0.00
+# Upper right foot, top panel
+ 0.20 0.20 0.05
+ 0.15 0.10 0.05
+ 0.25 0.10 0.05
+ 0.20 0.20 0.05
+ 0.10 0.15 0.05
+ 0.15 0.10 0.05
+ 0.20 0.20 0.05
+ 0.10 0.25 0.05
+ 0.10 0.15 0.05
+ 0.20 0.20 0.05
+ 0.15 0.30 0.05
+ 0.10 0.25 0.05
+ 0.20 0.20 0.05
+ 0.25 0.30 0.05
+ 0.15 0.30 0.05
+ 0.20 0.20 0.05
+ 0.30 0.25 0.05
+ 0.25 0.30 0.05
+ 0.20 0.20 0.05
+ 0.30 0.15 0.05
+ 0.30 0.25 0.05
+ 0.20 0.20 0.05
+ 0.25 0.10 0.05
+ 0.30 0.15 0.05
+# Upper left foot, top panel
+ -0.20 0.20 0.05
+ -0.25 0.10 0.05
+ -0.15 0.10 0.05
+ -0.20 0.20 0.05
+ -0.15 0.10 0.05
+ -0.10 0.15 0.05
+ -0.20 0.20 0.05
+ -0.10 0.15 0.05
+ -0.10 0.25 0.05
+ -0.20 0.20 0.05
+ -0.10 0.25 0.05
+ -0.15 0.30 0.05
+ -0.20 0.20 0.05
+ -0.15 0.30 0.05
+ -0.25 0.30 0.05
+ -0.20 0.20 0.05
+ -0.25 0.30 0.05
+ -0.30 0.25 0.05
+ -0.20 0.20 0.05
+ -0.30 0.25 0.05
+ -0.30 0.15 0.05
+ -0.20 0.20 0.05
+ -0.30 0.15 0.05
+ -0.25 0.10 0.05
+# Lower left foot, top panel
+ -0.20 -0.20 0.05
+ -0.15 -0.10 0.05
+ -0.25 -0.10 0.05
+ -0.20 -0.20 0.05
+ -0.10 -0.15 0.05
+ -0.15 -0.10 0.05
+ -0.20 -0.20 0.05
+ -0.10 -0.25 0.05
+ -0.10 -0.15 0.05
+ -0.20 -0.20 0.05
+ -0.15 -0.30 0.05
+ -0.10 -0.25 0.05
+ -0.20 -0.20 0.05
+ -0.25 -0.30 0.05
+ -0.15 -0.30 0.05
+ -0.20 -0.20 0.05
+ -0.30 -0.25 0.05
+ -0.25 -0.30 0.05
+ -0.20 -0.20 0.05
+ -0.30 -0.15 0.05
+ -0.30 -0.25 0.05
+ -0.20 -0.20 0.05
+ -0.25 -0.10 0.05
+ -0.30 -0.15 0.05
+# Lower right foot, top panel
+ 0.20 -0.20 0.05
+ 0.25 -0.10 0.05
+ 0.15 -0.10 0.05
+ 0.20 -0.20 0.05
+ 0.15 -0.10 0.05
+ 0.10 -0.15 0.05
+ 0.20 -0.20 0.05
+ 0.10 -0.15 0.05
+ 0.10 -0.25 0.05
+ 0.20 -0.20 0.05
+ 0.10 -0.25 0.05
+ 0.15 -0.30 0.05
+ 0.20 -0.20 0.05
+ 0.15 -0.30 0.05
+ 0.25 -0.30 0.05
+ 0.20 -0.20 0.05
+ 0.25 -0.30 0.05
+ 0.30 -0.25 0.05
+ 0.20 -0.20 0.05
+ 0.30 -0.25 0.05
+ 0.30 -0.15 0.05
+ 0.20 -0.20 0.05
+ 0.30 -0.15 0.05
+ 0.25 -0.10 0.05
+
+QUADS
+colour 0.0 0.5 0.2
+# Front indicator
+ -0.10 0.30 0.05
+ 0.10 0.30 0.05
+ 0.10 0.35 0.05
+ -0.10 0.35 0.05
+
diff --git a/data/models/lander.obj b/data/models/lander.obj
new file mode 100644
index 0000000..e6e1844
--- /dev/null
+++ b/data/models/lander.obj
@@ -0,0 +1,1863 @@
+# Blender3D v244 OBJ File: lander.blend
+# www.blender3d.org
+o Cube.006_Cube
+v -1.962721 2.508066 0.478097
+v -1.962721 2.508066 2.478096
+v -3.962721 2.508066 2.478096
+v -3.962721 2.508066 0.478097
+v -1.962721 4.508066 0.478097
+v -1.962721 4.508066 2.478096
+v -3.962721 4.508066 2.478096
+v -3.962721 4.508066 0.478097
+v -2.962721 2.508066 4.042511
+v -1.522007 2.508066 1.478097
+v -2.962721 2.508066 0.073064
+v -4.454828 2.508066 1.478097
+v -1.962721 4.508066 1.478096
+v -2.962721 4.508066 2.478096
+v -3.962721 4.508066 1.478096
+v -2.962721 4.508066 0.478097
+v -1.962721 3.508066 2.478096
+v -1.962721 3.508066 0.478097
+v -3.962721 3.508066 2.478096
+v -3.962721 3.508066 0.478097
+v -2.962721 2.508066 1.478097
+v -2.962721 4.508066 1.478096
+v -1.962721 3.508066 1.478097
+v -2.962721 3.508066 2.478096
+v -3.962721 3.508066 1.478097
+v -2.962721 3.508066 0.478097
+v -3.462721 2.508066 4.042511
+v -2.462721 2.508066 4.042511
+v -1.522007 2.508066 0.978097
+v -1.522007 2.508066 1.978097
+v -3.462721 2.508066 0.073064
+v -2.462721 2.508066 0.073064
+v -4.454828 2.508066 1.978097
+v -4.454828 2.508066 0.978097
+v -1.962721 4.508066 0.978096
+v -1.962721 4.508066 1.978096
+v -2.462721 4.508066 2.478096
+v -3.462721 4.508066 2.478096
+v -3.962721 4.508066 1.978096
+v -3.962721 4.508066 0.978096
+v -2.462721 4.508066 0.478097
+v -3.462721 4.508066 0.478097
+v -1.962721 4.008066 2.478096
+v -1.962721 3.008066 2.478096
+v -1.962721 4.008066 0.478097
+v -1.962721 3.008066 0.478097
+v -3.962721 3.008066 2.478096
+v -3.962721 4.008066 2.478096
+v -3.962721 3.008066 0.478097
+v -3.962721 4.008066 0.478097
+v -2.962721 2.508066 0.978097
+v -3.462721 2.508066 1.478097
+v -2.962721 2.508066 1.978097
+v -2.462721 2.508066 1.478097
+v -3.462721 4.508066 1.478096
+v -2.962721 4.508066 0.978096
+v -2.462721 4.508066 1.478096
+v -2.962721 4.508066 1.978096
+v -1.962721 4.008066 1.478096
+v -1.962721 3.508066 0.978097
+v -1.522007 3.008066 1.478097
+v -1.962721 3.508066 1.978097
+v -2.962721 4.008066 2.478096
+v -2.462721 3.508066 2.478096
+v -2.962721 3.008066 4.042511
+v -3.462721 3.508066 2.478096
+v -3.962721 4.008066 1.478096
+v -3.962721 3.508066 1.978097
+v -4.454828 3.008066 1.478097
+v -3.962721 3.508066 0.978097
+v -2.962721 4.008066 0.478097
+v -3.462721 3.508066 0.478097
+v -2.962721 3.008066 0.073064
+v -2.462721 3.508066 0.478097
+v -3.462721 2.508066 0.978097
+v -3.462721 2.508066 1.978097
+v -2.462721 2.508066 0.978097
+v -2.462721 2.508066 1.978097
+v -3.462721 4.508066 0.978096
+v -2.462721 4.508066 0.978096
+v -3.462721 4.508066 1.978096
+v -2.462721 4.508066 1.978096
+v -1.962721 4.008066 0.978097
+v -1.522007 3.008066 0.978097
+v -1.962721 4.008066 1.978096
+v -1.522007 3.008066 1.978097
+v -2.462721 4.008066 2.478096
+v -2.462721 3.008066 4.042511
+v -3.462721 4.008066 2.478096
+v -3.462721 3.008066 4.042511
+v -3.962721 4.008066 1.978096
+v -4.454828 3.008066 1.978097
+v -3.962721 4.008066 0.978097
+v -4.454828 3.008066 0.978097
+v -3.462721 4.008066 0.478097
+v -3.462721 3.008066 0.073064
+v -2.462721 4.008066 0.478097
+v -2.462721 3.008066 0.073064
+v -3.712721 2.508066 2.478096
+v -3.212721 2.508066 4.042511
+v -2.712721 2.508066 4.042511
+v -2.212721 2.508066 2.478096
+v -1.522007 2.508066 1.228097
+v -1.962721 2.508066 0.728097
+v -1.522007 2.508066 1.728097
+v -1.962721 2.508066 2.228096
+v -3.212721 2.508066 0.073064
+v -3.712721 2.508066 0.478097
+v -2.712721 2.508066 0.073064
+v -2.212721 2.508066 0.478097
+v -4.454828 2.508066 1.728097
+v -3.962721 2.508066 2.228096
+v -4.454828 2.508066 1.228097
+v -3.962721 2.508066 0.728097
+v -1.962721 4.508066 1.228096
+v -1.962721 4.508066 0.728096
+v -1.962721 4.508066 1.728096
+v -1.962721 4.508066 2.228096
+v -2.712721 4.508066 2.478096
+v -2.212721 4.508066 2.478096
+v -3.212721 4.508066 2.478096
+v -3.712721 4.508066 2.478096
+v -3.962721 4.508066 1.728096
+v -3.962721 4.508066 2.228096
+v -3.962721 4.508066 1.228096
+v -3.962721 4.508066 0.728096
+v -2.712721 4.508066 0.478097
+v -2.212721 4.508066 0.478097
+v -3.212721 4.508066 0.478097
+v -3.712721 4.508066 0.478097
+v -1.962721 3.758066 2.478096
+v -1.962721 4.258066 2.478096
+v -1.962721 3.258066 2.478096
+v -1.962721 2.758066 2.478096
+v -1.962721 3.758066 0.478097
+v -1.962721 4.258066 0.478097
+v -1.962721 3.258066 0.478097
+v -1.962721 2.758066 0.478097
+v -3.962721 3.258066 2.478096
+v -3.962721 2.758066 2.478096
+v -3.962721 3.758066 2.478096
+v -3.962721 4.258066 2.478096
+v -3.962721 3.258066 0.478097
+v -3.962721 2.758066 0.478097
+v -3.962721 3.758066 0.478097
+v -3.962721 4.258066 0.478097
+v -2.962721 2.508066 0.728097
+v -2.962721 2.508066 1.228097
+v -3.712721 2.508066 1.478097
+v -3.212721 2.508066 1.478097
+v -2.962721 2.508066 1.728097
+v -2.962721 2.508066 2.228096
+v -2.212721 2.508066 1.478097
+v -2.712721 2.508066 1.478097
+v -3.712721 4.508066 1.478096
+v -3.212721 4.508066 1.478096
+v -2.962721 4.508066 0.728096
+v -2.962721 4.508066 1.228096
+v -2.212721 4.508066 1.478096
+v -2.712721 4.508066 1.478096
+v -2.962721 4.508066 2.228096
+v -2.962721 4.508066 1.728096
+v -1.962721 4.258066 1.478096
+v -1.962721 3.758066 1.478096
+v -1.962721 3.508066 0.728097
+v -1.962721 3.508066 1.228097
+v -1.522007 2.758066 1.478097
+v -1.522007 3.258066 1.478097
+v -1.962721 3.508066 2.228096
+v -1.962721 3.508066 1.728097
+v -2.962721 4.258066 2.478096
+v -2.962721 3.758066 2.478096
+v -2.212721 3.508066 2.478096
+v -2.712721 3.508066 2.478096
+v -2.962721 3.258066 4.042511
+v -2.962721 2.758066 4.042511
+v -3.712721 3.508066 2.478096
+v -3.212721 3.508066 2.478096
+v -3.962721 4.258066 1.478096
+v -3.962721 3.758066 1.478096
+v -3.962721 3.508066 2.228096
+v -3.962721 3.508066 1.728097
+v -4.454828 2.758066 1.478097
+v -4.454828 3.258066 1.478097
+v -3.962721 3.508066 0.728097
+v -3.962721 3.508066 1.228097
+v -2.962721 4.258066 0.478097
+v -2.962721 3.758066 0.478097
+v -3.712721 3.508066 0.478097
+v -3.212721 3.508066 0.478097
+v -2.962721 2.758066 0.073064
+v -2.962721 3.258066 0.073064
+v -2.212721 3.508066 0.478097
+v -2.712721 3.508066 0.478097
+v -3.462721 2.508066 0.728097
+v -3.712721 2.508066 0.978097
+v -3.462721 2.508066 1.228097
+v -3.212721 2.508066 0.978097
+v -3.462721 2.508066 1.728097
+v -3.712721 2.508066 1.978097
+v -3.462721 2.508066 2.228096
+v -3.212721 2.508066 1.978097
+v -2.462721 2.508066 0.728097
+v -2.712721 2.508066 0.978097
+v -2.462721 2.508066 1.228097
+v -2.212721 2.508066 0.978097
+v -2.462721 2.508066 1.728097
+v -2.712721 2.508066 1.978097
+v -2.462721 2.508066 2.228096
+v -2.212721 2.508066 1.978097
+v -3.712721 4.508066 0.978096
+v -3.462721 4.508066 0.728096
+v -3.212721 4.508066 0.978096
+v -3.462721 4.508066 1.228096
+v -2.712721 4.508066 0.978096
+v -2.462721 4.508066 0.728096
+v -2.212721 4.508066 0.978096
+v -2.462721 4.508066 1.228096
+v -3.712721 4.508066 1.978096
+v -3.462721 4.508066 1.728096
+v -3.212721 4.508066 1.978096
+v -3.462721 4.508066 2.228096
+v -2.712721 4.508066 1.978096
+v -2.462721 4.508066 1.728096
+v -2.212721 4.508066 1.978096
+v -2.462721 4.508066 2.228096
+v -1.962721 4.258066 0.978097
+v -1.962721 4.008066 0.728097
+v -1.962721 3.758066 0.978097
+v -1.962721 4.008066 1.228096
+v -1.522007 3.258066 0.978097
+v -1.962721 3.008066 0.728097
+v -1.522007 2.758066 0.978097
+v -1.522007 3.008066 1.228097
+v -1.962721 4.258066 1.978096
+v -1.962721 4.008066 1.728096
+v -1.962721 3.758066 1.978096
+v -1.962721 4.008066 2.228096
+v -1.522007 3.258066 1.978097
+v -1.522007 3.008066 1.728097
+v -1.522007 2.758066 1.978097
+v -1.962721 3.008066 2.228096
+v -2.462721 4.258066 2.478096
+v -2.212721 4.008066 2.478096
+v -2.462721 3.758066 2.478096
+v -2.712721 4.008066 2.478096
+v -2.462721 3.258066 4.042511
+v -2.212721 3.008066 2.478096
+v -2.462721 2.758066 4.042511
+v -2.712721 3.008066 4.042511
+v -3.462721 4.258066 2.478096
+v -3.212721 4.008066 2.478096
+v -3.462721 3.758066 2.478096
+v -3.712721 4.008066 2.478096
+v -3.462721 3.258066 4.042511
+v -3.212721 3.008066 4.042511
+v -3.462721 2.758066 4.042511
+v -3.712721 3.008066 2.478096
+v -3.962721 4.258066 1.978096
+v -3.962721 4.008066 2.228096
+v -3.962721 3.758066 1.978096
+v -3.962721 4.008066 1.728096
+v -4.454828 3.258066 1.978097
+v -3.962721 3.008066 2.228096
+v -4.454828 2.758066 1.978097
+v -4.454828 3.008066 1.728097
+v -3.962721 4.258066 0.978097
+v -3.962721 4.008066 1.228096
+v -3.962721 3.758066 0.978097
+v -3.962721 4.008066 0.728097
+v -4.454828 3.258066 0.978097
+v -4.454828 3.008066 1.228097
+v -4.454828 2.758066 0.978097
+v -3.962721 3.008066 0.728097
+v -3.462721 4.258066 0.478097
+v -3.712721 4.008066 0.478097
+v -3.462721 3.758066 0.478097
+v -3.212721 4.008066 0.478097
+v -3.462721 3.258066 0.073064
+v -3.712721 3.008066 0.478097
+v -3.462721 2.758066 0.073064
+v -3.212721 3.008066 0.073064
+v -2.462721 4.258066 0.478097
+v -2.712721 4.008066 0.478097
+v -2.462721 3.758066 0.478097
+v -2.212721 4.008066 0.478097
+v -2.462721 3.258066 0.073064
+v -2.712721 3.008066 0.073064
+v -2.462721 2.758066 0.073064
+v -2.212721 3.008066 0.478097
+v -3.712721 2.508066 0.728097
+v -3.712721 2.508066 1.228097
+v -3.212721 2.508066 0.728097
+v -3.212721 2.508066 1.228097
+v -3.712721 2.508066 1.728097
+v -3.712721 2.508066 2.228096
+v -3.212721 2.508066 1.728097
+v -3.212721 2.508066 2.228096
+v -2.712721 2.508066 0.728097
+v -2.712721 2.508066 1.228097
+v -2.212721 2.508066 0.728097
+v -2.212721 2.508066 1.228097
+v -2.712721 2.508066 1.728097
+v -2.712721 2.508066 2.228096
+v -2.212721 2.508066 1.728097
+v -2.212721 2.508066 2.228096
+v -3.712721 4.508066 0.728096
+v -3.212721 4.508066 0.728096
+v -3.712721 4.508066 1.228096
+v -3.212721 4.508066 1.228096
+v -2.712721 4.508066 0.728096
+v -2.212721 4.508066 0.728096
+v -2.712721 4.508066 1.228096
+v -2.212721 4.508066 1.228096
+v -3.712721 4.508066 1.728096
+v -3.212721 4.508066 1.728096
+v -3.712721 4.508066 2.228096
+v -3.212721 4.508066 2.228096
+v -2.712721 4.508066 1.728096
+v -2.212721 4.508066 1.728096
+v -2.712721 4.508066 2.228096
+v -2.212721 4.508066 2.228096
+v -1.962721 4.258066 0.728097
+v -1.962721 3.758066 0.728097
+v -1.962721 4.258066 1.228096
+v -1.962721 3.758066 1.228096
+v -1.962721 3.258066 0.728097
+v -1.962721 2.758066 0.728097
+v -1.522007 3.258066 1.228097
+v -1.522007 2.758066 1.228097
+v -1.962721 4.258066 1.728096
+v -1.962721 3.758066 1.728096
+v -1.962721 4.258066 2.228096
+v -1.962721 3.758066 2.228096
+v -1.522007 3.258066 1.728097
+v -1.522007 2.758066 1.728097
+v -1.962721 3.258066 2.228096
+v -1.962721 2.758066 2.228096
+v -2.212721 4.258066 2.478096
+v -2.212721 3.758066 2.478096
+v -2.712721 4.258066 2.478096
+v -2.712721 3.758066 2.478096
+v -2.212721 3.258066 2.478096
+v -2.212721 2.758066 2.478096
+v -2.712721 3.258066 4.042511
+v -2.712721 2.758066 4.042511
+v -3.212721 4.258066 2.478096
+v -3.212721 3.758066 2.478096
+v -3.712721 4.258066 2.478096
+v -3.712721 3.758066 2.478096
+v -3.212721 3.258066 4.042511
+v -3.212721 2.758066 4.042511
+v -3.712721 3.258066 2.478096
+v -3.712721 2.758066 2.478096
+v -3.962721 4.258066 2.228096
+v -3.962721 3.758066 2.228096
+v -3.962721 4.258066 1.728096
+v -3.962721 3.758066 1.728096
+v -3.962721 3.258066 2.228096
+v -3.962721 2.758066 2.228096
+v -4.454828 3.258066 1.728097
+v -4.454828 2.758066 1.728097
+v -3.962721 4.258066 1.228096
+v -3.962721 3.758066 1.228096
+v -3.962721 4.258066 0.728097
+v -3.962721 3.758066 0.728097
+v -4.454828 3.258066 1.228097
+v -4.454828 2.758066 1.228097
+v -3.962721 3.258066 0.728097
+v -3.962721 2.758066 0.728097
+v -3.712721 4.258066 0.478097
+v -3.712721 3.758066 0.478097
+v -3.212721 4.258066 0.478097
+v -3.212721 3.758066 0.478097
+v -3.712721 3.258066 0.478097
+v -3.712721 2.758066 0.478097
+v -3.212721 3.258066 0.073064
+v -3.212721 2.758066 0.073064
+v -2.712721 4.258066 0.478097
+v -2.712721 3.758066 0.478097
+v -2.212721 4.258066 0.478097
+v -2.212721 3.758066 0.478097
+v -2.712721 3.258066 0.073064
+v -2.712721 2.758066 0.073064
+v -2.212721 3.258066 0.478097
+v -2.212721 2.758066 0.478097
+vn 0.000000 -1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 -0.000002
+vn 1.000000 0.000000 0.000000
+vn 0.625754 0.551558 -0.551558
+vn 0.493404 -0.000000 -0.869801
+vn 0.493403 0.869801 0.000000
+vn 0.493404 0.869801 0.000000
+vn 0.625754 0.551558 0.551558
+vn 0.493403 0.000000 0.869801
+vn 0.000000 0.000000 1.000000
+vn 0.689713 0.689713 0.220438
+vn 0.987471 0.000000 0.157802
+vn 0.000000 0.987471 0.157802
+vn -0.689713 0.689713 0.220438
+vn -0.987471 0.000000 0.157802
+vn -1.000000 0.000000 0.000000
+vn -0.583475 0.574263 0.574264
+vn -0.452925 0.000000 0.891549
+vn -0.452925 0.891549 0.000000
+vn -0.583475 0.574263 -0.574263
+vn -0.452925 -0.000000 -0.891549
+vn 0.000000 0.000000 -1.000000
+vn -0.532706 0.532706 -0.657608
+vn -0.850955 -0.000000 -0.525238
+vn 0.000000 0.850955 -0.525238
+vn 0.532706 0.532706 -0.657608
+vn 0.850955 -0.000000 -0.525238
+usemtl (null)
+usemtl (null)
+s 1
+f 114//1 4//1 108//1 291//1
+f 34//1 114//1 291//1 196//1
+f 291//1 108//1 31//1 195//1
+f 196//1 291//1 195//1 75//1
+f 113//1 34//1 196//1 292//1
+f 12//1 113//1 292//1 149//1
+f 292//1 196//1 75//1 197//1
+f 149//1 292//1 197//1 52//1
+f 195//1 31//1 107//1 293//1
+f 75//1 195//1 293//1 198//1
+f 293//1 107//1 11//1 147//1
+f 198//1 293//1 147//1 51//1
+f 197//1 75//1 198//1 294//1
+f 52//1 197//1 294//1 150//1
+f 294//1 198//1 51//1 148//1
+f 150//1 294//1 148//1 21//1
+f 111//1 12//1 149//1 295//1
+f 33//1 111//1 295//1 200//1
+f 295//1 149//1 52//1 199//1
+f 200//1 295//1 199//1 76//1
+f 112//1 33//1 200//1 296//1
+f 3//1 112//1 296//1 99//1
+f 296//1 200//1 76//1 201//1
+f 99//1 296//1 201//1 27//1
+f 199//1 52//1 150//1 297//1
+f 76//1 199//1 297//1 202//1
+f 297//1 150//1 21//1 151//1
+f 202//1 297//1 151//1 53//1
+f 201//1 76//1 202//1 298//1
+f 27//1 201//1 298//1 100//1
+f 298//1 202//1 53//1 152//1
+f 100//1 298//1 152//1 9//1
+f 147//1 11//1 109//1 299//1
+f 51//1 147//1 299//1 204//1
+f 299//1 109//1 32//1 203//1
+f 204//1 299//1 203//1 77//1
+f 148//1 51//1 204//1 300//1
+f 21//1 148//1 300//1 154//1
+f 300//1 204//1 77//1 205//1
+f 154//1 300//1 205//1 54//1
+f 203//1 32//1 110//1 301//1
+f 77//1 203//1 301//1 206//1
+f 1//1 104//1 301//1 110//1
+f 206//1 301//1 104//1 29//1
+f 205//1 77//1 206//1 302//1
+f 54//1 205//1 302//1 153//1
+f 302//1 206//1 29//1 103//1
+f 153//1 302//1 103//1 10//1
+f 151//1 21//1 154//1 303//1
+f 53//1 151//1 303//1 208//1
+f 303//1 154//1 54//1 207//1
+f 208//1 303//1 207//1 78//1
+f 152//1 53//1 208//1 304//1
+f 9//1 152//1 304//1 101//1
+f 304//1 208//1 78//1 209//1
+f 101//1 304//1 209//1 28//1
+f 207//1 54//1 153//1 305//1
+f 78//1 207//1 305//1 210//1
+f 305//1 153//1 10//1 105//1
+f 210//1 305//1 105//1 30//1
+f 209//1 78//1 210//1 306//1
+f 28//1 209//1 306//1 102//1
+f 306//1 210//1 30//1 106//1
+f 102//1 306//1 106//1 2//1
+f 130//2 8//2 126//2 307//2
+f 42//2 130//2 307//2 212//2
+f 307//2 126//2 40//2 211//2
+f 212//2 307//2 211//2 79//2
+f 129//2 42//2 212//2 308//2
+f 16//2 129//2 308//2 157//2
+f 308//2 212//2 79//2 213//2
+f 157//2 308//2 213//2 56//2
+f 211//2 40//2 125//2 309//2
+f 79//2 211//2 309//2 214//2
+f 309//2 125//2 15//2 155//2
+f 214//2 309//2 155//2 55//2
+f 213//2 79//2 214//2 310//2
+f 56//2 213//2 310//2 158//2
+f 310//2 214//2 55//2 156//2
+f 158//2 310//2 156//2 22//2
+f 127//2 16//2 157//2 311//2
+f 41//2 127//2 311//2 216//2
+f 311//2 157//2 56//2 215//2
+f 216//2 311//2 215//2 80//2
+f 128//2 41//2 216//2 312//2
+f 5//2 128//2 312//2 116//2
+f 312//2 216//2 80//2 217//2
+f 116//2 312//2 217//2 35//2
+f 215//2 56//2 158//2 313//2
+f 80//2 215//2 313//2 218//2
+f 313//2 158//2 22//2 160//2
+f 218//2 313//2 160//2 57//2
+f 217//2 80//2 218//2 314//2
+f 35//2 217//2 314//2 115//2
+f 314//2 218//2 57//2 159//2
+f 115//2 314//2 159//2 13//2
+f 155//2 15//2 123//2 315//2
+f 55//2 155//2 315//2 220//2
+f 315//2 123//2 39//2 219//2
+f 220//2 315//2 219//2 81//2
+f 156//2 55//2 220//2 316//2
+f 22//2 156//2 316//2 162//2
+f 316//2 220//2 81//2 221//2
+f 162//2 316//2 221//2 58//2
+f 219//3 39//3 124//3 317//3
+f 81//3 219//3 317//3 222//3
+f 317//2 124//2 7//2 122//2
+f 222//2 317//2 122//2 38//2
+f 221//3 81//3 222//3 318//3
+f 58//3 221//3 318//3 161//3
+f 318//2 222//2 38//2 121//2
+f 161//2 318//2 121//2 14//2
+f 160//2 22//2 162//2 319//2
+f 57//2 160//2 319//2 224//2
+f 319//2 162//2 58//2 223//2
+f 224//2 319//2 223//2 82//2
+f 159//2 57//2 224//2 320//2
+f 13//2 159//2 320//2 117//2
+f 320//2 224//2 82//2 225//2
+f 117//2 320//2 225//2 36//2
+f 223//3 58//3 161//3 321//3
+f 82//3 223//3 321//3 226//3
+f 321//2 161//2 14//2 119//2
+f 226//2 321//2 119//2 37//2
+f 225//3 82//3 226//3 322//3
+f 36//3 225//3 322//3 118//3
+f 322//2 226//2 37//2 120//2
+f 118//2 322//2 120//2 6//2
+f 136//4 5//4 116//4 323//4
+f 45//4 136//4 323//4 228//4
+f 323//4 116//4 35//4 227//4
+f 228//4 323//4 227//4 83//4
+f 135//4 45//4 228//4 324//4
+f 18//4 135//4 324//4 165//4
+f 324//4 228//4 83//4 229//4
+f 165//4 324//4 229//4 60//4
+f 227//4 35//4 115//4 325//4
+f 83//4 227//4 325//4 230//4
+f 325//4 115//4 13//4 163//4
+f 230//4 325//4 163//4 59//4
+f 229//4 83//4 230//4 326//4
+f 60//4 229//4 326//4 166//4
+f 326//4 230//4 59//4 164//4
+f 166//4 326//4 164//4 23//4
+f 137//4 18//4 165//4 327//4
+f 46//4 137//4 327//4 232//4
+f 327//5 165//5 60//5 231//5
+f 232//6 327//6 231//6 84//6
+f 138//4 46//4 232//4 328//4
+f 1//4 138//4 328//4 104//4
+f 328//6 232//6 84//6 233//6
+f 104//6 328//6 233//6 29//6
+f 231//7 60//7 166//7 329//7
+f 84//4 231//4 329//4 234//4
+f 329//8 166//8 23//8 168//8
+f 234//4 329//4 168//4 61//4
+f 233//4 84//4 234//4 330//4
+f 29//4 233//4 330//4 103//4
+f 330//4 234//4 61//4 167//4
+f 103//4 330//4 167//4 10//4
+f 163//4 13//4 117//4 331//4
+f 59//4 163//4 331//4 236//4
+f 331//4 117//4 36//4 235//4
+f 236//4 331//4 235//4 85//4
+f 164//4 59//4 236//4 332//4
+f 23//4 164//4 332//4 170//4
+f 332//4 236//4 85//4 237//4
+f 170//4 332//4 237//4 62//4
+f 235//4 36//4 118//4 333//4
+f 85//4 235//4 333//4 238//4
+f 333//4 118//4 6//4 132//4
+f 238//4 333//4 132//4 43//4
+f 237//4 85//4 238//4 334//4
+f 62//4 237//4 334//4 169//4
+f 334//4 238//4 43//4 131//4
+f 169//4 334//4 131//4 17//4
+f 168//8 23//8 170//8 335//8
+f 61//4 168//4 335//4 240//4
+f 335//8 170//8 62//8 239//8
+f 240//4 335//4 239//4 86//4
+f 167//4 61//4 240//4 336//4
+f 10//4 167//4 336//4 105//4
+f 336//4 240//4 86//4 241//4
+f 105//4 336//4 241//4 30//4
+f 239//9 62//9 169//9 337//9
+f 86//10 239//10 337//10 242//10
+f 337//4 169//4 17//4 133//4
+f 242//4 337//4 133//4 44//4
+f 241//10 86//10 242//10 338//10
+f 30//10 241//10 338//10 106//10
+f 338//4 242//4 44//4 134//4
+f 106//4 338//4 134//4 2//4
+f 132//11 6//11 120//11 339//11
+f 43//11 132//11 339//11 244//11
+f 339//11 120//11 37//11 243//11
+f 244//11 339//11 243//11 87//11
+f 131//11 43//11 244//11 340//11
+f 17//11 131//11 340//11 173//11
+f 340//11 244//11 87//11 245//11
+f 173//11 340//11 245//11 64//11
+f 243//11 37//11 119//11 341//11
+f 87//11 243//11 341//11 246//11
+f 341//11 119//11 14//11 171//11
+f 246//11 341//11 171//11 63//11
+f 245//11 87//11 246//11 342//11
+f 64//11 245//11 342//11 174//11
+f 342//11 246//11 63//11 172//11
+f 174//11 342//11 172//11 24//11
+f 133//11 17//11 173//11 343//11
+f 44//11 133//11 343//11 248//11
+f 343//12 173//12 64//12 247//12
+f 248//13 343//13 247//13 88//13
+f 134//11 44//11 248//11 344//11
+f 2//11 134//11 344//11 102//11
+f 344//13 248//13 88//13 249//13
+f 102//13 344//13 249//13 28//13
+f 247//14 64//14 174//14 345//14
+f 88//11 247//11 345//11 250//11
+f 345//14 174//14 24//14 175//14
+f 250//11 345//11 175//11 65//11
+f 249//11 88//11 250//11 346//11
+f 28//11 249//11 346//11 101//11
+f 346//11 250//11 65//11 176//11
+f 101//11 346//11 176//11 9//11
+f 171//11 14//11 121//11 347//11
+f 63//11 171//11 347//11 252//11
+f 347//11 121//11 38//11 251//11
+f 252//11 347//11 251//11 89//11
+f 172//11 63//11 252//11 348//11
+f 24//11 172//11 348//11 178//11
+f 348//11 252//11 89//11 253//11
+f 178//11 348//11 253//11 66//11
+f 251//11 38//11 122//11 349//11
+f 89//11 251//11 349//11 254//11
+f 349//11 122//11 7//11 142//11
+f 254//11 349//11 142//11 48//11
+f 253//11 89//11 254//11 350//11
+f 66//11 253//11 350//11 177//11
+f 350//11 254//11 48//11 141//11
+f 177//11 350//11 141//11 19//11
+f 175//14 24//14 178//14 351//14
+f 65//11 175//11 351//11 256//11
+f 351//14 178//14 66//14 255//14
+f 256//11 351//11 255//11 90//11
+f 176//11 65//11 256//11 352//11
+f 9//11 176//11 352//11 100//11
+f 352//11 256//11 90//11 257//11
+f 100//11 352//11 257//11 27//11
+f 255//15 66//15 177//15 353//15
+f 90//16 255//16 353//16 258//16
+f 353//11 177//11 19//11 139//11
+f 258//11 353//11 139//11 47//11
+f 257//16 90//16 258//16 354//16
+f 27//16 257//16 354//16 99//16
+f 354//11 258//11 47//11 140//11
+f 99//11 354//11 140//11 3//11
+f 142//17 7//17 124//17 355//17
+f 48//17 142//17 355//17 260//17
+f 355//17 124//17 39//17 259//17
+f 260//17 355//17 259//17 91//17
+f 141//17 48//17 260//17 356//17
+f 19//17 141//17 356//17 181//17
+f 356//17 260//17 91//17 261//17
+f 181//17 356//17 261//17 68//17
+f 259//17 39//17 123//17 357//17
+f 91//17 259//17 357//17 262//17
+f 357//17 123//17 15//17 179//17
+f 262//17 357//17 179//17 67//17
+f 261//17 91//17 262//17 358//17
+f 68//17 261//17 358//17 182//17
+f 358//17 262//17 67//17 180//17
+f 182//17 358//17 180//17 25//17
+f 139//17 19//17 181//17 359//17
+f 47//17 139//17 359//17 264//17
+f 359//18 181//18 68//18 263//18
+f 264//19 359//19 263//19 92//19
+f 140//17 47//17 264//17 360//17
+f 3//17 140//17 360//17 112//17
+f 360//19 264//19 92//19 265//19
+f 112//19 360//19 265//19 33//19
+f 263//20 68//20 182//20 361//20
+f 92//17 263//17 361//17 266//17
+f 361//20 182//20 25//20 184//20
+f 266//17 361//17 184//17 69//17
+f 265//17 92//17 266//17 362//17
+f 33//17 265//17 362//17 111//17
+f 362//17 266//17 69//17 183//17
+f 111//17 362//17 183//17 12//17
+f 179//17 15//17 125//17 363//17
+f 67//17 179//17 363//17 268//17
+f 363//17 125//17 40//17 267//17
+f 268//17 363//17 267//17 93//17
+f 180//17 67//17 268//17 364//17
+f 25//17 180//17 364//17 186//17
+f 364//17 268//17 93//17 269//17
+f 186//17 364//17 269//17 70//17
+f 267//17 40//17 126//17 365//17
+f 93//17 267//17 365//17 270//17
+f 365//17 126//17 8//17 146//17
+f 270//17 365//17 146//17 50//17
+f 269//17 93//17 270//17 366//17
+f 70//17 269//17 366//17 185//17
+f 366//17 270//17 50//17 145//17
+f 185//17 366//17 145//17 20//17
+f 184//20 25//20 186//20 367//20
+f 69//17 184//17 367//17 272//17
+f 367//20 186//20 70//20 271//20
+f 272//17 367//17 271//17 94//17
+f 183//17 69//17 272//17 368//17
+f 12//17 183//17 368//17 113//17
+f 368//17 272//17 94//17 273//17
+f 113//17 368//17 273//17 34//17
+f 271//21 70//21 185//21 369//21
+f 94//22 271//22 369//22 274//22
+f 369//17 185//17 20//17 143//17
+f 274//17 369//17 143//17 49//17
+f 273//22 94//22 274//22 370//22
+f 34//22 273//22 370//22 114//22
+f 370//17 274//17 49//17 144//17
+f 114//17 370//17 144//17 4//17
+f 146//23 8//23 130//23 371//23
+f 50//23 146//23 371//23 276//23
+f 371//23 130//23 42//23 275//23
+f 276//23 371//23 275//23 95//23
+f 145//23 50//23 276//23 372//23
+f 20//23 145//23 372//23 189//23
+f 372//23 276//23 95//23 277//23
+f 189//23 372//23 277//23 72//23
+f 275//23 42//23 129//23 373//23
+f 95//23 275//23 373//23 278//23
+f 373//23 129//23 16//23 187//23
+f 278//23 373//23 187//23 71//23
+f 277//23 95//23 278//23 374//23
+f 72//23 277//23 374//23 190//23
+f 374//23 278//23 71//23 188//23
+f 190//23 374//23 188//23 26//23
+f 143//23 20//23 189//23 375//23
+f 49//23 143//23 375//23 280//23
+f 375//24 189//24 72//24 279//24
+f 280//25 375//25 279//25 96//25
+f 144//23 49//23 280//23 376//23
+f 4//23 144//23 376//23 108//23
+f 376//25 280//25 96//25 281//25
+f 108//25 376//25 281//25 31//25
+f 279//26 72//26 190//26 377//26
+f 96//23 279//23 377//23 282//23
+f 377//26 190//26 26//26 192//26
+f 282//23 377//23 192//23 73//23
+f 281//23 96//23 282//23 378//23
+f 31//23 281//23 378//23 107//23
+f 378//23 282//23 73//23 191//23
+f 107//23 378//23 191//23 11//23
+f 187//23 16//23 127//23 379//23
+f 71//23 187//23 379//23 284//23
+f 379//23 127//23 41//23 283//23
+f 284//23 379//23 283//23 97//23
+f 188//23 71//23 284//23 380//23
+f 26//23 188//23 380//23 194//23
+f 380//23 284//23 97//23 285//23
+f 194//23 380//23 285//23 74//23
+f 283//23 41//23 128//23 381//23
+f 97//23 283//23 381//23 286//23
+f 381//23 128//23 5//23 136//23
+f 286//23 381//23 136//23 45//23
+f 285//23 97//23 286//23 382//23
+f 74//23 285//23 382//23 193//23
+f 382//23 286//23 45//23 135//23
+f 193//23 382//23 135//23 18//23
+f 192//26 26//26 194//26 383//26
+f 73//23 192//23 383//23 288//23
+f 383//26 194//26 74//26 287//26
+f 288//23 383//23 287//23 98//23
+f 191//23 73//23 288//23 384//23
+f 11//23 191//23 384//23 109//23
+f 384//23 288//23 98//23 289//23
+f 109//23 384//23 289//23 32//23
+f 287//27 74//27 193//27 385//27
+f 98//28 287//28 385//28 290//28
+f 385//23 193//23 18//23 137//23
+f 290//23 385//23 137//23 46//23
+f 289//28 98//28 290//28 386//28
+f 32//28 289//28 386//28 110//28
+f 386//23 290//23 46//23 138//23
+f 138//23 1//23 110//23 386//23
+o Cube.004_Cube.005
+v -1.478241 1.000000 4.420625
+v -2.478241 1.000000 5.420625
+v -3.478241 1.000000 5.420625
+v -4.478241 1.000000 4.420625
+v -4.478241 1.000000 3.420624
+v -3.478241 1.000000 2.420624
+v -2.478241 1.000000 2.420625
+v -1.478241 1.000000 3.420625
+v -1.478241 1.000000 4.420625
+v -2.478241 1.000000 5.420625
+v -3.478241 1.000000 5.420625
+v -4.478241 1.000000 4.420625
+v -4.478241 1.000000 3.420624
+v -3.478241 1.000000 2.420624
+v -1.478241 1.000000 3.420625
+v -1.478241 1.000000 4.420625
+v -2.478241 1.000000 5.420625
+v -4.478241 1.000000 3.420624
+v -3.478241 1.000000 2.420624
+v -2.478241 1.000000 2.420625
+v -1.478241 1.000000 3.420625
+v -1.478241 1.000000 4.420625
+v -2.478241 1.000000 5.420625
+v -3.478241 1.000000 5.420625
+v -4.478241 1.000000 4.420625
+v -4.478241 1.000000 3.420624
+v -3.478241 1.000000 2.420624
+v -2.478241 1.000000 2.420625
+v -1.478241 0.551004 4.420625
+v -2.478241 0.551004 5.420625
+v -3.478241 0.551004 5.420625
+v -4.478241 0.551004 4.420625
+v -4.478241 0.551004 3.420624
+v -3.478241 0.551004 2.420625
+v -2.478241 0.551004 2.420625
+v -1.478241 0.551004 3.420625
+v -2.267481 2.237493 4.154775
+v -2.735781 2.237493 4.623075
+v -3.204081 2.237493 4.623075
+v -3.672381 2.237493 4.154775
+v -3.672381 2.237493 3.686475
+v -3.204081 2.237493 3.218175
+v -2.735781 2.237493 3.218175
+v -2.267481 2.237493 3.686475
+v -2.267481 2.237493 4.154775
+v -2.735781 2.237493 4.623075
+v -3.204081 2.237493 4.623075
+v -3.672381 2.237493 4.154775
+v -3.672381 2.237493 3.686475
+v -3.204081 2.237493 3.218175
+v -2.267481 2.237493 3.686475
+v -2.267481 2.237493 4.154775
+v -2.735781 2.237493 4.623075
+v -3.672381 2.237493 3.686475
+v -3.204081 2.237493 3.218175
+v -2.735781 2.237493 3.218175
+v -2.267481 2.237493 3.686475
+v -2.267481 2.237493 4.154775
+v -2.735781 2.237493 4.623075
+v -3.204081 2.237493 4.623075
+v -3.672381 2.237493 4.154775
+v -3.672381 2.237493 3.686475
+v -3.204081 2.237493 3.218175
+v -2.735781 2.237493 3.218175
+v -2.267481 1.029207 4.154775
+v -2.735781 1.029207 4.623075
+v -3.204081 1.029207 4.623075
+v -3.672381 1.029207 4.154775
+v -3.672381 1.029207 3.686475
+v -3.204081 1.029207 3.218175
+v -2.735781 1.029207 3.218175
+v -2.267481 1.029207 3.686475
+v -2.735781 2.237493 3.218175
+v -3.204081 2.237493 3.218175
+v -3.672381 2.237493 3.686475
+v -3.672381 2.237493 4.154775
+v -3.204081 2.237493 4.623075
+v -2.735781 2.237493 4.623075
+v -2.267481 2.237493 4.154775
+v -2.267481 2.237493 3.686475
+v -2.735781 2.237493 3.218175
+v -3.204081 2.237493 3.218175
+v -3.672381 2.237493 3.686475
+v -2.735781 2.237493 4.623075
+v -2.267481 2.237493 4.154775
+v -2.267481 2.237493 3.686475
+v -3.204081 2.237493 3.218175
+v -3.672381 2.237493 3.686475
+v -3.672381 2.237493 4.154775
+v -3.204081 2.237493 4.623075
+v -2.735781 2.237493 4.623075
+v -2.267481 2.237493 4.154775
+v -2.267481 2.237493 3.686475
+v -2.735781 2.237493 3.218175
+v -3.204081 2.237493 3.218175
+v -3.672381 2.237493 3.686475
+v -3.672381 2.237493 4.154775
+v -3.204081 2.237493 4.623075
+v -2.735781 2.237493 4.623075
+v -2.267481 2.237493 4.154775
+v -2.252305 3.246810 3.184079
+v -2.720605 3.246810 3.652378
+v -3.188905 3.246810 3.652378
+v -3.657205 3.246810 3.184079
+v -3.657205 3.246810 2.715779
+v -3.188905 3.246810 2.247479
+v -2.720605 3.246810 2.247479
+v -2.252305 3.246810 2.715779
+v -2.252305 3.246810 3.184079
+v -2.720605 3.246810 3.652378
+v -3.188905 3.246810 3.652378
+v -3.657205 3.246810 3.184079
+v -3.657205 3.246810 2.715779
+v -3.188905 3.246810 2.247479
+v -2.252305 3.246810 2.715779
+v -2.252305 3.246810 3.184079
+v -2.720605 3.246810 3.652378
+v -3.657205 3.246810 2.715779
+v -3.188905 3.246810 2.247479
+v -2.720605 3.246810 2.247479
+v -2.252305 3.246810 2.715779
+v -2.252305 3.246810 3.184079
+v -2.720605 3.246810 3.652378
+v -3.188905 3.246810 3.652378
+v -3.657205 3.246810 3.184079
+v -3.657205 3.246810 2.715779
+v -3.188905 3.246810 2.247479
+v -2.720605 3.246810 2.247479
+vn 0.587601 0.556282 0.587601
+vn 0.000000 0.693182 0.720762
+vn -0.581820 0.568305 0.581820
+vn -0.999887 0.015034 -0.000000
+vn 0.000000 -0.693182 -0.720762
+vn 0.581820 -0.568305 -0.581820
+vn 0.000000 0.000000 0.000000
+vn -0.587601 -0.556282 -0.587601
+vn 0.999887 -0.015034 0.000000
+vn 0.707083 -0.707083 0.000000
+vn 0.138096 0.932615 -0.333384
+vn 0.749168 0.585131 -0.310312
+vn 0.923856 0.000000 -0.382672
+vn 0.382550 -0.023499 -0.923612
+vn 0.310312 0.585131 -0.749168
+vn 0.333628 0.933256 -0.133000
+vn 0.316202 -0.894406 0.316202
+vn 0.707083 0.000000 0.707083
+vn 0.630665 0.730735 0.261208
+vn 0.630665 0.730735 -0.261208
+vn 0.707083 0.000000 -0.707083
+vn 0.261208 0.730735 -0.630665
+vn 0.000000 -0.707083 -0.707083
+vn -0.261208 0.730735 -0.630665
+vn -0.499985 -0.707083 -0.499985
+vn -0.707083 0.000000 -0.707083
+vn 0.382427 -0.035249 -0.923276
+vn 0.703207 -0.710959 0.000000
+vn 0.000000 -0.832026 -0.554674
+vn -0.720084 -0.693838 0.000000
+vn -0.587573 -0.556261 -0.587573
+vn -0.145543 -0.827754 -0.541856
+vn -0.709494 0.704672 0.000000
+vn -0.145634 -0.026765 -0.988952
+usemtl Material
+s 1
+f 387//1 388//1 389//1 401//1
+f 391//1 392//1 393//1 398//1
+f 393//1 401//1 389//1 398//1
+f 423//1 424//1 425//1 437//1
+f 427//1 428//1 429//1 434//1
+f 429//1 437//1 425//1 434//1
+f 480//1 472//1 484//1 475//1
+f 482//1 481//1 480//1 475//1
+f 486//1 485//1 484//1 472//1
+f 485//29 486//29 487//29 488//29
+f 484//30 485//30 488//30 489//30
+f 483//31 484//31 489//31 490//31
+f 482//32 483//32 490//32 491//32
+f 480//33 481//33 492//33 493//33
+f 479//34 480//34 493//34 494//34
+f 479//32 486//32 487//32 494//32
+f 478//35 486//35 487//35 495//35
+f 477//35 485//35 488//35 496//35
+f 476//35 484//35 489//35 497//35
+f 475//35 483//35 490//35 498//35
+f 473//35 481//35 492//35 500//35
+f 472//35 479//35 494//35 501//35
+f 471//35 478//35 495//35 502//35
+f 470//35 477//35 496//35 503//35
+f 469//35 474//35 499//35 504//35
+f 468//35 473//35 500//35 505//35
+f 466//35 472//35 501//35 507//35
+f 465//35 471//35 502//35 508//35
+f 464//35 470//35 503//35 509//35
+f 461//35 469//35 504//35 512//35
+f 460//35 468//35 505//35 513//35
+f 459//35 467//35 506//35 514//35
+f 473//30 480//30 493//30 500//30
+f 482//32 475//32 498//32 491//32
+f 476//34 483//34 490//34 497//34
+f 477//33 484//33 489//33 496//33
+f 478//36 485//36 488//36 495//36
+f 475//31 484//31 489//31 498//31
+f 472//34 480//34 493//34 501//34
+f 486//37 472//37 501//37 487//37
+f 462//35 475//35 498//35 511//35
+f 463//35 484//35 489//35 510//35
+f 467//35 480//35 493//35 506//35
+f 489//2 501//2 493//2 498//2
+f 493//2 492//2 491//2 498//2
+f 489//2 488//2 487//2 501//2
+s 1
+f 387//38 415//39 422//40 394//41
+s 1
+f 393//42 394//41 422//40 421//43
+s 1
+f 393//42 421//43 420//44 400//23
+s 1
+f 400//23 420//44 413//35 405//35
+s 1
+f 392//45 399//46 419//47 420//44
+s 1
+f 391//38 399//46 392//45
+s 1
+f 391//38 398//38 418//48 419//47
+s 1
+f 390//49 397//49 417//50 418//48
+s 1
+f 389//51 396//23 416//52 417//50
+s 1
+f 388//53 395//54 415//39 416//52
+s 1
+f 418//48 421//43 420//44 419//47
+s 1
+f 417//50 422//40 421//43 418//48
+s 1
+f 415//39 422//40 417//50 416//52
+s 1
+f 423//38 451//39 458//40 430//41
+s 1
+f 429//55 430//41 458//40 457//43
+s 1
+f 429//55 457//43 456//44 436//23
+s 1
+f 436//23 456//44 449//35 441//35
+s 1
+f 428//45 435//46 455//47 456//44
+s 1
+f 427//38 435//46 428//45
+s 1
+f 427//38 434//56 454//48 455//47
+s 1
+f 426//49 433//49 453//50 454//48
+s 1
+f 425//57 432//23 452//52 453//50
+s 1
+f 424//53 431//54 451//39 452//52
+s 1
+f 454//48 457//43 456//44 455//47
+s 1
+f 453//50 458//40 457//43 454//48
+s 1
+f 451//39 458//40 453//50 452//52
+s 1
+f 482//58 474//59 481//60
+s 1
+f 474//59 482//58 491//61 499//59
+s 1
+f 481//60 474//59 499//59 492//62
+s 1
+f 492//62 499//59 491//61
+o Cube.003_Cube.004
+v -1.552799 1.000000 -1.488066
+v -2.552799 1.000000 -2.488066
+v -3.552799 1.000000 -2.488067
+v -4.552799 1.000000 -1.488067
+v -4.552799 1.000000 -0.488067
+v -3.552799 1.000000 0.511933
+v -2.552799 1.000000 0.511934
+v -1.552799 1.000000 -0.488066
+v -1.552799 1.000000 -1.488066
+v -2.552799 1.000000 -2.488066
+v -3.552799 1.000000 -2.488067
+v -4.552799 1.000000 -1.488067
+v -4.552799 1.000000 -0.488067
+v -3.552799 1.000000 0.511933
+v -1.552799 1.000000 -0.488066
+v -1.552799 1.000000 -1.488066
+v -2.552799 1.000000 -2.488066
+v -4.552799 1.000000 -0.488067
+v -3.552799 1.000000 0.511933
+v -2.552799 1.000000 0.511934
+v -1.552799 1.000000 -0.488066
+v -1.552799 1.000000 -1.488066
+v -2.552799 1.000000 -2.488066
+v -3.552799 1.000000 -2.488067
+v -4.552799 1.000000 -1.488067
+v -4.552799 1.000000 -0.488067
+v -3.552799 1.000000 0.511933
+v -2.552799 1.000000 0.511934
+v -1.552799 0.551004 -1.488066
+v -2.552799 0.551004 -2.488066
+v -3.552799 0.551004 -2.488066
+v -4.552799 0.551004 -1.488067
+v -4.552799 0.551004 -0.488067
+v -3.552799 0.551004 0.511933
+v -2.552799 0.551004 0.511934
+v -1.552799 0.551004 -0.488066
+v -2.342038 2.237492 -1.222216
+v -2.810338 2.237492 -1.690516
+v -3.278638 2.237492 -1.690516
+v -3.746938 2.237492 -1.222217
+v -3.746938 2.237492 -0.753917
+v -3.278638 2.237492 -0.285617
+v -2.810338 2.237492 -0.285617
+v -2.342038 2.237492 -0.753917
+v -2.342038 2.237492 -1.222216
+v -2.810338 2.237492 -1.690516
+v -3.278638 2.237492 -1.690516
+v -3.746938 2.237492 -1.222217
+v -3.746938 2.237492 -0.753917
+v -3.278638 2.237492 -0.285617
+v -2.342038 2.237492 -0.753917
+v -2.342038 2.237492 -1.222216
+v -2.810338 2.237492 -1.690516
+v -3.746938 2.237492 -0.753917
+v -3.278638 2.237492 -0.285617
+v -2.810338 2.237492 -0.285617
+v -2.342038 2.237492 -0.753917
+v -2.342038 2.237492 -1.222216
+v -2.810338 2.237492 -1.690516
+v -3.278638 2.237492 -1.690516
+v -3.746938 2.237492 -1.222217
+v -3.746938 2.237492 -0.753917
+v -3.278638 2.237492 -0.285617
+v -2.810338 2.237492 -0.285617
+v -2.342038 1.029207 -1.222216
+v -2.810338 1.029207 -1.690516
+v -3.278638 1.029207 -1.690516
+v -3.746938 1.029207 -1.222216
+v -3.746938 1.029207 -0.753917
+v -3.278638 1.029207 -0.285617
+v -2.810338 1.029207 -0.285617
+v -2.342038 1.029207 -0.753917
+v -2.810338 2.237492 -0.285617
+v -3.278638 2.237492 -0.285617
+v -3.746938 2.237492 -0.753917
+v -3.746938 2.237492 -1.222217
+v -3.278638 2.237492 -1.690516
+v -2.810338 2.237492 -1.690516
+v -2.342038 2.237492 -1.222216
+v -2.342038 2.237492 -0.753917
+v -2.810338 2.237492 -0.285617
+v -3.278638 2.237492 -0.285617
+v -3.746938 2.237492 -0.753917
+v -2.810338 2.237492 -1.690516
+v -2.342038 2.237492 -1.222216
+v -2.342038 2.237492 -0.753917
+v -3.278638 2.237492 -0.285617
+v -3.746938 2.237492 -0.753917
+v -3.746938 2.237492 -1.222217
+v -3.278638 2.237492 -1.690516
+v -2.810338 2.237492 -1.690516
+v -2.342038 2.237492 -1.222216
+v -2.342038 2.237492 -0.753917
+v -2.810338 2.237492 -0.285617
+v -3.278638 2.237492 -0.285617
+v -3.746938 2.237492 -0.753917
+v -3.746938 2.237492 -1.222217
+v -3.278638 2.237492 -1.690516
+v -2.810338 2.237492 -1.690516
+v -2.342038 2.237492 -1.222216
+v -2.326863 3.246810 -0.251521
+v -2.795162 3.246810 -0.719820
+v -3.263462 3.246810 -0.719821
+v -3.731762 3.246810 -0.251521
+v -3.731762 3.246810 0.216779
+v -3.263462 3.246810 0.685079
+v -2.795162 3.246810 0.685079
+v -2.326863 3.246810 0.216779
+v -2.326863 3.246810 -0.251521
+v -2.795162 3.246810 -0.719820
+v -3.263462 3.246810 -0.719821
+v -3.731762 3.246810 -0.251521
+v -3.731762 3.246810 0.216779
+v -3.263462 3.246810 0.685079
+v -2.326863 3.246810 0.216779
+v -2.326863 3.246810 -0.251521
+v -2.795162 3.246810 -0.719820
+v -3.731762 3.246810 0.216779
+v -3.263462 3.246810 0.685079
+v -2.795162 3.246810 0.685079
+v -2.326863 3.246810 0.216779
+v -2.326863 3.246810 -0.251521
+v -2.795162 3.246810 -0.719820
+v -3.263462 3.246810 -0.719821
+v -3.731762 3.246810 -0.251521
+v -3.731762 3.246810 0.216779
+v -3.263462 3.246810 0.685079
+v -2.795162 3.246810 0.685079
+vn -0.587601 -0.556282 0.587601
+vn -0.000000 -0.693182 0.720762
+vn 0.581820 -0.568305 0.581820
+vn 0.000000 0.693182 -0.720762
+vn -0.581820 0.568305 -0.581820
+vn 0.587601 0.556282 -0.587601
+vn -0.707083 0.707083 0.000000
+vn -0.138096 -0.932615 -0.333384
+vn -0.749168 -0.585131 -0.310312
+vn -0.923856 0.000000 -0.382672
+vn -0.382550 0.023499 -0.923612
+vn -0.310312 -0.585131 -0.749168
+vn -0.333628 -0.933256 -0.133000
+vn -0.316202 0.894406 0.316202
+vn -0.707083 0.000000 0.707083
+vn -0.630665 -0.730735 0.261208
+vn -0.630665 -0.730735 -0.261208
+vn -0.261208 -0.730735 -0.630665
+vn 0.000000 0.707083 -0.707083
+vn 0.261208 -0.730735 -0.630665
+vn 0.499985 0.707083 -0.499985
+vn -0.382427 0.035249 -0.923276
+vn -0.703207 0.710959 0.000000
+vn 0.000000 0.832026 -0.554674
+vn 0.720084 0.693838 0.000000
+vn 0.587573 0.556261 -0.587573
+vn 0.145543 0.827754 -0.541856
+vn 0.709494 -0.704672 0.000000
+vn 0.145634 0.026765 -0.988952
+usemtl Material
+s 1
+f 515//2 516//2 517//2 529//2
+f 519//2 520//2 521//2 526//2
+f 521//2 529//2 517//2 526//2
+f 551//2 552//2 553//2 565//2
+f 555//2 556//2 557//2 562//2
+f 557//2 565//2 553//2 562//2
+f 608//2 600//2 612//2 603//2
+f 610//2 609//2 608//2 603//2
+f 614//2 613//2 612//2 600//2
+f 613//63 614//63 615//63 616//63
+f 612//64 613//64 616//64 617//64
+f 611//65 612//65 617//65 618//65
+f 610//37 611//37 618//37 619//37
+f 608//66 609//66 620//66 621//66
+f 607//67 608//67 621//67 622//67
+f 607//37 614//37 615//37 622//37
+f 606//35 614//35 615//35 623//35
+f 605//35 613//35 616//35 624//35
+f 604//35 612//35 617//35 625//35
+f 603//35 611//35 618//35 626//35
+f 601//35 609//35 620//35 628//35
+f 600//35 607//35 622//35 629//35
+f 599//35 606//35 623//35 630//35
+f 598//35 605//35 624//35 631//35
+f 597//35 602//35 627//35 632//35
+f 596//35 601//35 628//35 633//35
+f 594//35 600//35 629//35 635//35
+f 593//35 599//35 630//35 636//35
+f 592//35 598//35 631//35 637//35
+f 589//35 597//35 632//35 640//35
+f 588//35 596//35 633//35 641//35
+f 587//35 595//35 634//35 642//35
+f 601//64 608//64 621//64 628//64
+f 610//37 603//37 626//37 619//37
+f 604//67 611//67 618//67 625//67
+f 605//66 612//66 617//66 624//66
+f 606//68 613//68 616//68 623//68
+f 603//65 612//65 617//65 626//65
+f 600//67 608//67 621//67 629//67
+f 614//32 600//32 629//32 615//32
+f 590//35 603//35 626//35 639//35
+f 591//35 612//35 617//35 638//35
+f 595//35 608//35 621//35 634//35
+f 617//1 629//1 621//1 626//1
+f 621//1 620//1 619//1 626//1
+f 617//1 616//1 615//1 629//1
+s 1
+f 515//69 543//70 550//71 522//72
+s 1
+f 521//73 522//72 550//71 549//74
+s 1
+f 521//73 549//74 548//75 528//23
+s 1
+f 528//23 548//75 541//35 533//35
+s 1
+f 520//76 527//77 547//78 548//75
+s 1
+f 519//69 527//77 520//76
+s 1
+f 519//69 526//69 546//79 547//78
+s 1
+f 518//54 525//54 545//80 546//79
+s 1
+f 517//81 524//23 544//82 545//80
+s 1
+f 516//83 523//49 543//70 544//82
+s 1
+f 546//79 549//74 548//75 547//78
+s 1
+f 545//80 550//71 549//74 546//79
+s 1
+f 543//70 550//71 545//80 544//82
+s 1
+f 551//69 579//70 586//71 558//72
+s 1
+f 557//84 558//72 586//71 585//74
+s 1
+f 557//84 585//74 584//75 564//23
+s 1
+f 564//23 584//75 577//35 569//35
+s 1
+f 556//76 563//77 583//78 584//75
+s 1
+f 555//69 563//77 556//76
+s 1
+f 555//69 562//85 582//79 583//78
+s 1
+f 554//54 561//54 581//80 582//79
+s 1
+f 553//86 560//23 580//82 581//80
+s 1
+f 552//83 559//49 579//70 580//82
+s 1
+f 582//79 585//74 584//75 583//78
+s 1
+f 581//80 586//71 585//74 582//79
+s 1
+f 579//70 586//71 581//80 580//82
+s 1
+f 610//87 602//88 609//89
+s 1
+f 602//88 610//87 619//90 627//88
+s 1
+f 609//89 602//88 627//88 620//91
+s 1
+f 620//91 627//88 619//90
+o Cube_Cube.003
+v -5.908691 1.000000 0.074558
+v -6.908691 1.000000 1.074558
+v -6.908691 1.000000 2.074558
+v -5.908691 1.000000 3.074558
+v -4.908691 1.000000 3.074558
+v -3.908691 1.000000 2.074558
+v -3.908691 1.000000 1.074558
+v -4.908691 1.000000 0.074558
+v -5.908691 1.000000 0.074558
+v -6.908691 1.000000 1.074558
+v -6.908691 1.000000 2.074558
+v -5.908691 1.000000 3.074558
+v -4.908691 1.000000 3.074558
+v -3.908691 1.000000 2.074558
+v -4.908691 1.000000 0.074558
+v -5.908691 1.000000 0.074558
+v -6.908691 1.000000 1.074558
+v -4.908691 1.000000 3.074558
+v -3.908691 1.000000 2.074558
+v -3.908691 1.000000 1.074558
+v -4.908691 1.000000 0.074558
+v -5.908691 1.000000 0.074558
+v -6.908691 1.000000 1.074558
+v -6.908691 1.000000 2.074558
+v -5.908691 1.000000 3.074558
+v -4.908691 1.000000 3.074558
+v -3.908691 1.000000 2.074558
+v -3.908691 1.000000 1.074558
+v -5.908691 0.551004 0.074558
+v -6.908691 0.551004 1.074558
+v -6.908691 0.551004 2.074558
+v -5.908691 0.551004 3.074558
+v -4.908691 0.551004 3.074558
+v -3.908691 0.551004 2.074558
+v -3.908691 0.551004 1.074558
+v -4.908691 0.551004 0.074558
+v -5.642841 2.237492 0.863797
+v -6.111141 2.237492 1.332097
+v -6.111141 2.237492 1.800397
+v -5.642841 2.237492 2.268697
+v -5.174541 2.237492 2.268697
+v -4.706242 2.237492 1.800397
+v -4.706242 2.237492 1.332097
+v -5.174541 2.237492 0.863797
+v -5.642841 2.237492 0.863797
+v -6.111141 2.237492 1.332097
+v -6.111141 2.237492 1.800397
+v -5.642841 2.237492 2.268697
+v -5.174541 2.237492 2.268697
+v -4.706242 2.237492 1.800397
+v -5.174541 2.237492 0.863797
+v -5.642841 2.237492 0.863797
+v -6.111141 2.237492 1.332097
+v -5.174541 2.237492 2.268697
+v -4.706242 2.237492 1.800397
+v -4.706242 2.237492 1.332097
+v -5.174541 2.237492 0.863797
+v -5.642841 2.237492 0.863797
+v -6.111141 2.237492 1.332097
+v -6.111141 2.237492 1.800397
+v -5.642841 2.237492 2.268697
+v -5.174541 2.237492 2.268697
+v -4.706242 2.237492 1.800397
+v -4.706242 2.237492 1.332097
+v -5.642841 1.029207 0.863797
+v -6.111141 1.029207 1.332097
+v -6.111141 1.029207 1.800397
+v -5.642841 1.029207 2.268697
+v -5.174541 1.029207 2.268697
+v -4.706242 1.029207 1.800397
+v -4.706242 1.029207 1.332097
+v -5.174541 1.029207 0.863797
+v -4.706242 2.237492 1.332097
+v -4.706242 2.237492 1.800397
+v -5.174541 2.237492 2.268697
+v -5.642841 2.237492 2.268697
+v -6.111141 2.237492 1.800397
+v -6.111141 2.237492 1.332097
+v -5.642841 2.237492 0.863797
+v -5.174541 2.237492 0.863797
+v -4.706242 2.237492 1.332097
+v -4.706242 2.237492 1.800397
+v -5.174541 2.237492 2.268697
+v -6.111141 2.237492 1.332097
+v -5.642841 2.237492 0.863797
+v -5.174541 2.237492 0.863797
+v -4.706242 2.237492 1.800397
+v -5.174541 2.237492 2.268697
+v -5.642841 2.237492 2.268697
+v -6.111141 2.237492 1.800397
+v -6.111141 2.237492 1.332097
+v -5.642841 2.237492 0.863797
+v -5.174541 2.237492 0.863797
+v -4.706242 2.237492 1.332097
+v -4.706242 2.237492 1.800397
+v -5.174541 2.237492 2.268697
+v -5.642841 2.237492 2.268697
+v -6.111141 2.237492 1.800397
+v -6.111141 2.237492 1.332097
+v -5.642841 2.237492 0.863797
+v -4.672145 3.246810 0.848621
+v -5.140445 3.246810 1.316921
+v -5.140445 3.246810 1.785221
+v -4.672145 3.246810 2.253521
+v -4.203846 3.246810 2.253521
+v -3.735546 3.246810 1.785221
+v -3.735546 3.246810 1.316921
+v -4.203846 3.246810 0.848621
+v -4.672145 3.246810 0.848621
+v -5.140445 3.246810 1.316921
+v -5.140445 3.246810 1.785221
+v -4.672145 3.246810 2.253521
+v -4.203846 3.246810 2.253521
+v -3.735546 3.246810 1.785221
+v -4.203846 3.246810 0.848621
+v -4.672145 3.246810 0.848621
+v -5.140445 3.246810 1.316921
+v -4.203846 3.246810 2.253521
+v -3.735546 3.246810 1.785221
+v -3.735546 3.246810 1.316921
+v -4.203846 3.246810 0.848621
+v -4.672145 3.246810 0.848621
+v -5.140445 3.246810 1.316921
+v -5.140445 3.246810 1.785221
+v -4.672145 3.246810 2.253521
+v -4.203846 3.246810 2.253521
+v -3.735546 3.246810 1.785221
+v -3.735546 3.246810 1.316921
+vn 0.587601 -0.556282 0.587601
+vn 0.720762 -0.693182 0.000000
+vn 0.000000 -0.015034 -0.999887
+vn -0.720762 0.693182 0.000000
+vn -0.587601 0.556282 -0.587601
+vn 0.000000 0.015034 0.999887
+vn 0.000000 0.707083 0.707083
+vn -0.333384 -0.932615 0.138096
+vn -0.310312 -0.585131 0.749168
+vn -0.382672 0.000000 0.923856
+vn -0.923612 0.023499 0.382550
+vn -0.749168 -0.585131 0.310312
+vn -0.133000 -0.933256 0.333628
+vn 0.316202 0.894406 0.316202
+vn 0.261208 -0.730735 0.630665
+vn -0.261208 -0.730735 0.630665
+vn -0.499985 0.707083 -0.499985
+vn -0.923276 0.035249 0.382427
+vn 0.000000 0.710959 0.703207
+vn -0.554674 0.832026 0.000000
+vn 0.000000 0.693838 -0.720084
+vn -0.587573 0.556261 -0.587573
+vn -0.541856 0.827754 -0.145543
+vn 0.000000 -0.704672 -0.709494
+vn -0.988952 0.026765 -0.145634
+usemtl Material
+s 1
+f 643//2 644//2 645//2 657//2
+f 647//2 648//2 649//2 654//2
+f 649//2 657//2 645//2 654//2
+f 679//2 680//2 681//2 693//2
+f 683//2 684//2 685//2 690//2
+f 685//2 693//2 681//2 690//2
+f 736//2 728//2 740//2 731//2
+f 738//2 737//2 736//2 731//2
+f 742//2 741//2 740//2 728//2
+f 741//92 742//92 743//92 744//92
+f 740//93 741//93 744//93 745//93
+f 739//34 740//34 745//34 746//34
+f 738//94 739//94 746//94 747//94
+f 736//95 737//95 748//95 749//95
+f 735//31 736//31 749//31 750//31
+f 735//94 742//94 743//94 750//94
+f 734//35 742//35 743//35 751//35
+f 733//35 741//35 744//35 752//35
+f 732//35 740//35 745//35 753//35
+f 731//35 739//35 746//35 754//35
+f 729//35 737//35 748//35 756//35
+f 728//35 735//35 750//35 757//35
+f 727//35 734//35 751//35 758//35
+f 726//35 733//35 752//35 759//35
+f 725//35 730//35 755//35 760//35
+f 724//35 729//35 756//35 761//35
+f 722//35 728//35 757//35 763//35
+f 721//35 727//35 758//35 764//35
+f 720//35 726//35 759//35 765//35
+f 717//35 725//35 760//35 768//35
+f 716//35 724//35 761//35 769//35
+f 715//35 723//35 762//35 770//35
+f 729//93 736//93 749//93 756//93
+f 738//94 731//94 754//94 747//94
+f 732//31 739//31 746//31 753//31
+f 733//95 740//95 745//95 752//95
+f 734//96 741//96 744//96 751//96
+f 731//34 740//34 745//34 754//34
+f 728//31 736//31 749//31 757//31
+f 742//97 728//97 757//97 743//97
+f 718//35 731//35 754//35 767//35
+f 719//35 740//35 745//35 766//35
+f 723//35 736//35 749//35 762//35
+f 745//1 757//1 749//1 754//1
+f 749//1 748//1 747//1 754//1
+f 745//1 744//1 743//1 757//1
+s 1
+f 643//98 671//99 678//100 650//101
+s 1
+f 649//102 650//101 678//100 677//103
+s 1
+f 649//102 677//103 676//104 656//17
+s 1
+f 656//17 676//104 669//35 661//35
+s 1
+f 648//105 655//46 675//106 676//104
+s 1
+f 647//98 655//46 648//105
+s 1
+f 647//98 654//98 674//107 675//106
+s 1
+f 646//77 653//77 673//78 674//107
+s 1
+f 645//69 652//17 672//79 673//78
+s 1
+f 644//108 651//54 671//99 672//79
+s 1
+f 674//107 677//103 676//104 675//106
+s 1
+f 673//78 678//100 677//103 674//107
+s 1
+f 671//99 678//100 673//78 672//79
+s 1
+f 679//98 707//99 714//100 686//101
+s 1
+f 685//109 686//101 714//100 713//103
+s 1
+f 685//109 713//103 712//104 692//17
+s 1
+f 692//17 712//104 705//35 697//35
+s 1
+f 684//105 691//46 711//106 712//104
+s 1
+f 683//98 691//46 684//105
+s 1
+f 683//98 690//110 710//107 711//106
+s 1
+f 682//77 689//77 709//78 710//107
+s 1
+f 681//111 688//17 708//79 709//78
+s 1
+f 680//108 687//54 707//99 708//79
+s 1
+f 710//107 713//103 712//104 711//106
+s 1
+f 709//78 714//100 713//103 710//107
+s 1
+f 707//99 714//100 709//78 708//79
+s 1
+f 738//112 730//113 737//114
+s 1
+f 730//113 738//112 747//115 755//113
+s 1
+f 737//114 730//113 755//113 748//116
+s 1
+f 748//116 755//113 747//115
+o Cube.002
+v 0.000000 1.000000 -0.000000
+v 1.000000 1.000000 1.000000
+v 1.000000 1.000000 2.000000
+v 0.000000 1.000000 3.000000
+v -1.000000 1.000000 3.000000
+v -2.000000 1.000000 2.000000
+v -2.000000 1.000000 1.000000
+v -1.000000 1.000000 -0.000000
+v 0.000000 1.000000 -0.000000
+v 1.000000 1.000000 1.000000
+v 1.000000 1.000000 2.000000
+v 0.000000 1.000000 3.000000
+v -1.000000 1.000000 3.000000
+v -2.000000 1.000000 2.000000
+v -1.000000 1.000000 -0.000000
+v 0.000000 1.000000 -0.000000
+v 1.000000 1.000000 1.000000
+v -1.000000 1.000000 3.000000
+v -2.000000 1.000000 2.000000
+v -2.000000 1.000000 1.000000
+v -1.000000 1.000000 -0.000000
+v 0.000000 1.000000 -0.000000
+v 1.000000 1.000000 1.000000
+v 1.000000 1.000000 2.000000
+v 0.000000 1.000000 3.000000
+v -1.000000 1.000000 3.000000
+v -2.000000 1.000000 2.000000
+v -2.000000 1.000000 1.000000
+v 0.000000 0.551004 -0.000000
+v 1.000000 0.551004 1.000000
+v 1.000000 0.551004 2.000000
+v 0.000000 0.551004 3.000000
+v -1.000000 0.551004 3.000000
+v -2.000000 0.551004 2.000000
+v -2.000000 0.551004 1.000000
+v -1.000000 0.551004 -0.000000
+v -0.265850 2.237492 0.789240
+v 0.202450 2.237492 1.257539
+v 0.202450 2.237492 1.725839
+v -0.265850 2.237492 2.194139
+v -0.734150 2.237492 2.194139
+v -1.202450 2.237492 1.725839
+v -1.202450 2.237492 1.257539
+v -0.734150 2.237492 0.789240
+v -0.265850 2.237492 0.789240
+v 0.202450 2.237492 1.257539
+v 0.202450 2.237492 1.725839
+v -0.265850 2.237492 2.194139
+v -0.734150 2.237492 2.194139
+v -1.202450 2.237492 1.725839
+v -0.734150 2.237492 0.789240
+v -0.265850 2.237492 0.789240
+v 0.202450 2.237492 1.257539
+v -0.734150 2.237492 2.194139
+v -1.202450 2.237492 1.725839
+v -1.202450 2.237492 1.257539
+v -0.734150 2.237492 0.789240
+v -0.265850 2.237492 0.789240
+v 0.202450 2.237492 1.257539
+v 0.202450 2.237492 1.725839
+v -0.265850 2.237492 2.194139
+v -0.734150 2.237492 2.194139
+v -1.202450 2.237492 1.725839
+v -1.202450 2.237492 1.257539
+v -0.265850 1.029207 0.789240
+v 0.202450 1.029207 1.257540
+v 0.202450 1.029207 1.725839
+v -0.265850 1.029207 2.194139
+v -0.734150 1.029207 2.194139
+v -1.202450 1.029207 1.725839
+v -1.202450 1.029207 1.257540
+v -0.734150 1.029207 0.789240
+v -1.202450 2.237492 1.257539
+v -1.202450 2.237492 1.725839
+v -0.734150 2.237492 2.194139
+v -0.265850 2.237492 2.194139
+v 0.202450 2.237492 1.725839
+v 0.202450 2.237492 1.257539
+v -0.265850 2.237492 0.789240
+v -0.734150 2.237492 0.789240
+v -1.202450 2.237492 1.257539
+v -1.202450 2.237492 1.725839
+v -0.734150 2.237492 2.194139
+v 0.202450 2.237492 1.257539
+v -0.265850 2.237492 0.789240
+v -0.734150 2.237492 0.789240
+v -1.202450 2.237492 1.725839
+v -0.734150 2.237492 2.194139
+v -0.265850 2.237492 2.194139
+v 0.202450 2.237492 1.725839
+v 0.202450 2.237492 1.257539
+v -0.265850 2.237492 0.789240
+v -0.734150 2.237492 0.789240
+v -1.202450 2.237492 1.257539
+v -1.202450 2.237492 1.725839
+v -0.734150 2.237492 2.194139
+v -0.265850 2.237492 2.194139
+v 0.202450 2.237492 1.725839
+v 0.202450 2.237492 1.257539
+v -0.265850 2.237492 0.789240
+v -1.236546 3.246810 0.774064
+v -0.768246 3.246810 1.242363
+v -0.768246 3.246810 1.710663
+v -1.236546 3.246810 2.178963
+v -1.704846 3.246810 2.178963
+v -2.173146 3.246810 1.710663
+v -2.173146 3.246810 1.242363
+v -1.704846 3.246810 0.774064
+v -1.236546 3.246810 0.774064
+v -0.768246 3.246810 1.242363
+v -0.768246 3.246810 1.710663
+v -1.236546 3.246810 2.178963
+v -1.704846 3.246810 2.178963
+v -2.173146 3.246810 1.710663
+v -1.704846 3.246810 0.774064
+v -1.236546 3.246810 0.774064
+v -0.768246 3.246810 1.242363
+v -1.704846 3.246810 2.178963
+v -2.173146 3.246810 1.710663
+v -2.173146 3.246810 1.242363
+v -1.704846 3.246810 0.774064
+v -1.236546 3.246810 0.774064
+v -0.768246 3.246810 1.242363
+v -0.768246 3.246810 1.710663
+v -1.236546 3.246810 2.178963
+v -1.704846 3.246810 2.178963
+v -2.173146 3.246810 1.710663
+v -2.173146 3.246810 1.242363
+vn 0.720762 0.693182 0.000000
+vn 0.581820 0.568305 0.581820
+vn -0.720762 -0.693182 0.000000
+vn -0.581820 -0.568305 -0.581820
+vn -0.333384 0.932615 -0.138096
+vn -0.310312 0.585131 -0.749168
+vn -0.382672 0.000000 -0.923856
+vn -0.923612 -0.023499 -0.382550
+vn -0.749168 0.585131 -0.310312
+vn -0.133000 0.933256 -0.333628
+vn 0.316202 -0.894406 -0.316202
+vn -0.630665 0.730735 -0.261208
+vn -0.707083 -0.707083 0.000000
+vn -0.630665 0.730735 0.261208
+vn -0.499985 -0.707083 0.499985
+vn -0.923276 -0.035249 -0.382427
+vn 0.000000 -0.710959 -0.703207
+vn -0.554674 -0.832026 0.000000
+vn 0.000000 -0.693838 0.720084
+vn -0.587573 -0.556261 0.587573
+vn -0.541856 -0.827754 0.145543
+vn 0.000000 0.704672 0.709494
+vn -0.988952 -0.026765 0.145634
+usemtl Material
+s 1
+f 771//1 772//1 773//1 785//1
+f 775//1 776//1 777//1 782//1
+f 777//1 785//1 773//1 782//1
+f 807//1 808//1 809//1 821//1
+f 811//1 812//1 813//1 818//1
+f 813//1 821//1 809//1 818//1
+f 864//1 856//1 868//1 859//1
+f 866//1 865//1 864//1 859//1
+f 870//1 869//1 868//1 856//1
+f 869//68 870//68 871//68 872//68
+f 868//117 869//117 872//117 873//117
+f 867//118 868//118 873//118 874//118
+f 866//97 867//97 874//97 875//97
+f 864//119 865//119 876//119 877//119
+f 863//120 864//120 877//120 878//120
+f 863//97 870//97 871//97 878//97
+f 862//35 870//35 871//35 879//35
+f 861//35 869//35 872//35 880//35
+f 860//35 868//35 873//35 881//35
+f 859//35 867//35 874//35 882//35
+f 857//35 865//35 876//35 884//35
+f 856//35 863//35 878//35 885//35
+f 855//35 862//35 879//35 886//35
+f 854//35 861//35 880//35 887//35
+f 853//35 858//35 883//35 888//35
+f 852//35 857//35 884//35 889//35
+f 850//35 856//35 885//35 891//35
+f 849//35 855//35 886//35 892//35
+f 848//35 854//35 887//35 893//35
+f 845//35 853//35 888//35 896//35
+f 844//35 852//35 889//35 897//35
+f 843//35 851//35 890//35 898//35
+f 857//117 864//117 877//117 884//117
+f 866//97 859//97 882//97 875//97
+f 860//120 867//120 874//120 881//120
+f 861//119 868//119 873//119 880//119
+f 862//63 869//63 872//63 879//63
+f 859//118 868//118 873//118 882//118
+f 856//120 864//120 877//120 885//120
+f 870//94 856//94 885//94 871//94
+f 846//35 859//35 882//35 895//35
+f 847//35 868//35 873//35 894//35
+f 851//35 864//35 877//35 890//35
+f 873//2 885//2 877//2 882//2
+f 877//2 876//2 875//2 882//2
+f 873//2 872//2 871//2 885//2
+s 1
+f 771//51 799//121 806//122 778//123
+s 1
+f 777//124 778//123 806//122 805//125
+s 1
+f 777//124 805//125 804//126 784//17
+s 1
+f 784//17 804//126 797//35 789//35
+s 1
+f 776//127 783//49 803//50 804//126
+s 1
+f 775//51 783//49 776//127
+s 1
+f 775//51 782//51 802//52 803//50
+s 1
+f 774//54 781//54 801//128 802//52
+s 1
+f 773//129 780//17 800//130 801//128
+s 1
+f 772//131 779//77 799//121 800//130
+s 1
+f 802//52 805//125 804//126 803//50
+s 1
+f 801//128 806//122 805//125 802//52
+s 1
+f 799//121 806//122 801//128 800//130
+s 1
+f 807//51 835//121 842//122 814//123
+s 1
+f 813//132 814//123 842//122 841//125
+s 1
+f 813//132 841//125 840//126 820//17
+s 1
+f 820//17 840//126 833//35 825//35
+s 1
+f 812//127 819//49 839//50 840//126
+s 1
+f 811//51 819//49 812//127
+s 1
+f 811//51 818//133 838//52 839//50
+s 1
+f 810//54 817//54 837//128 838//52
+s 1
+f 809//134 816//17 836//130 837//128
+s 1
+f 808//131 815//77 835//121 836//130
+s 1
+f 838//52 841//125 840//126 839//50
+s 1
+f 837//128 842//122 841//125 838//52
+s 1
+f 835//121 842//122 837//128 836//130
+s 1
+f 866//135 858//136 865//137
+s 1
+f 858//136 866//135 875//138 883//136
+s 1
+f 865//137 858//136 883//136 876//139
+s 1
+f 876//139 883//136 875//138
diff --git a/data/models/platform b/data/models/platform
new file mode 100644
index 0000000..da92c34
--- /dev/null
+++ b/data/models/platform
@@ -0,0 +1,30 @@
+# Landing/refuelling platform
+
+QUADS
+ 1.00 1.00 0.05
+ -1.00 1.00 0.05
+ -1.00 -1.00 0.05
+ 1.00 -1.00 0.05
+#
+ 1.00 1.00 0.00
+ -1.00 1.00 0.00
+ -1.00 1.00 0.05
+ 1.00 1.00 0.05
+#
+ 1.00 -1.00 0.05
+ -1.00 -1.00 0.05
+ -1.00 -1.00 0.00
+ 1.00 -1.00 0.00
+#
+ 1.00 1.00 0.05
+ 1.00 -1.00 0.05
+ 1.00 -1.00 0.00
+ 1.00 1.00 0.00
+#
+ -1.00 1.00 0.00
+ -1.00 -1.00 0.00
+ -1.00 -1.00 0.05
+ -1.00 1.00 0.05
+#
+pulse 0.7 0.0 0.0
+
diff --git a/data/models/randombox b/data/models/randombox
new file mode 100644
index 0000000..b65a99e
--- /dev/null
+++ b/data/models/randombox
@@ -0,0 +1,30 @@
+# A random box
+
+QUADS
+ 0.50 0.50 0.50 0.1 0.1
+ -0.50 0.50 0.50 0.0 0.1
+ -0.50 -0.50 0.50 0.0 0.0
+ 0.50 -0.50 0.50 0.1 0.0
+#
+ 0.50 0.50 -0.50 0.2 0.1
+ -0.50 0.50 -0.50 0.1 0.1
+ -0.50 0.50 0.50 0.1 0.2
+ 0.50 0.50 0.50 0.2 0.2
+#
+ 0.50 -0.50 0.50 0.3 0.3
+ -0.50 -0.50 0.50 0.2 0.3
+ -0.50 -0.50 -0.50 0.2 0.2
+ 0.50 -0.50 -0.50 0.3 0.2
+#
+ 0.50 0.50 0.50 0.4 0.4
+ 0.50 -0.50 0.50 0.3 0.4
+ 0.50 -0.50 -0.50 0.3 0.3
+ 0.50 0.50 -0.50 0.4 0.3
+#
+ -0.50 0.50 -0.50 0.5 0.4
+ -0.50 -0.50 -0.50 0.4 0.4
+ -0.50 -0.50 0.50 0.4 0.5
+ -0.50 0.50 0.50 0.5 0.5
+#
+texture floor1
+
diff --git a/data/models/tiledfloor b/data/models/tiledfloor
new file mode 100644
index 0000000..4ccff27
--- /dev/null
+++ b/data/models/tiledfloor
@@ -0,0 +1,9 @@
+# Floor (tiled)
+
+QUADS
+texture tiledwall
+-5.0 -5.0 0.0 0.0 0.0
+ 5.0 -5.0 0.0 1.0 0.0
+ 5.0 5.0 0.0 1.0 1.0
+-5.0 5.0 0.0 0.0 1.0
+
diff --git a/data/models/walle b/data/models/walle
new file mode 100644
index 0000000..1913302
--- /dev/null
+++ b/data/models/walle
@@ -0,0 +1,9 @@
+# Wall (East)
+
+QUADS
+texture tiledwall
+ 0.00 -5.00 5.00 1.0 1.0
+ 0.00 5.00 5.00 0.0 1.0
+ 0.00 5.00 -5.00 0.0 0.0
+ 0.00 -5.00 -5.00 1.0 0.0
+
diff --git a/data/models/walln b/data/models/walln
new file mode 100644
index 0000000..7f63e33
--- /dev/null
+++ b/data/models/walln
@@ -0,0 +1,9 @@
+# Wall (North)
+
+QUADS
+texture tiledwall
+ -5.00 0.00 -5.00 0.0 0.0
+ 5.00 0.00 -5.00 1.0 0.0
+ 5.00 0.00 5.00 1.0 1.0
+ -5.00 0.00 5.00 0.0 1.0
+
diff --git a/data/models/walls b/data/models/walls
new file mode 100644
index 0000000..8927b8c
--- /dev/null
+++ b/data/models/walls
@@ -0,0 +1,9 @@
+# Wall (South)
+
+QUADS
+texture tiledwall
+ -5.00 0.00 -5.00 1.0 0.0
+ -5.00 0.00 5.00 1.0 1.0
+ 5.00 0.00 5.00 0.0 1.0
+ 5.00 0.00 -5.00 0.0 0.0
+
diff --git a/data/models/wallw b/data/models/wallw
new file mode 100644
index 0000000..5d7eabd
--- /dev/null
+++ b/data/models/wallw
@@ -0,0 +1,9 @@
+# Wall (West)
+
+QUADS
+texture tiledwall
+ 0.00 -5.00 -5.00 0.0 0.0
+ 0.00 5.00 -5.00 1.0 0.0
+ 0.00 5.00 5.00 1.0 1.0
+ 0.00 -5.00 5.00 0.0 1.0
+
diff --git a/data/rooms/00-00-00 b/data/rooms/00-00-00
new file mode 100644
index 0000000..baf5427
--- /dev/null
+++ b/data/rooms/00-00-00
@@ -0,0 +1,20 @@
+# Starting room
+
+connected 00 00 01
+connected 00 00 02
+connected 00 00 03
+connected 00 00 04
+
+light 5.0 0.0 0.0
+
+platform 0.0 0.0 -5.0
+floor 0.0 0.0 -5.0
+wallw -5.0 0.0 0.0
+walle 5.0 0.0 0.0
+walln 0.0 5.0 0.0
+walls 0.0 -5.0 0.0
+randombox -4.5 -4.5 -4.5
+randombox -4.5 4.5 -4.5
+randombox 4.5 -4.5 -4.5
+randombox 4.5 4.5 -4.5
+
diff --git a/data/rooms/00-00-01 b/data/rooms/00-00-01
new file mode 100644
index 0000000..da8d508
--- /dev/null
+++ b/data/rooms/00-00-01
@@ -0,0 +1,12 @@
+# Ventilation shaft, first floor
+
+connected 00 00 00
+connected 00 00 02
+connected 00 00 03
+connected 00 00 04
+
+wallw -5.0 0.0 0.0
+walle 5.0 0.0 0.0
+walln 0.0 5.0 0.0
+walls 0.0 -5.0 0.0
+
diff --git a/data/rooms/00-00-02 b/data/rooms/00-00-02
new file mode 100644
index 0000000..f12bbc1
--- /dev/null
+++ b/data/rooms/00-00-02
@@ -0,0 +1,12 @@
+# Ventilation shaft, second floor
+
+connected 00 00 00
+connected 00 00 01
+connected 00 00 03
+connected 00 00 04
+
+wallw -5.0 0.0 0.0
+walle 5.0 0.0 0.0
+walln 0.0 5.0 0.0
+walls 0.0 -5.0 0.0
+
diff --git a/data/rooms/00-00-03 b/data/rooms/00-00-03
new file mode 100644
index 0000000..08a37b8
--- /dev/null
+++ b/data/rooms/00-00-03
@@ -0,0 +1,14 @@
+# Ventilation shaft, third floor
+
+connected 00 00 00
+connected 00 00 01
+connected 00 00 02
+connected 00 00 04
+connected 00 01 04
+connected 00 02 04
+
+wallw -5.0 0.0 0.0
+walle 5.0 0.0 0.0
+walln 0.0 5.0 0.0
+walls 0.0 -5.0 0.0
+
diff --git a/data/rooms/00-00-04 b/data/rooms/00-00-04
new file mode 100644
index 0000000..0553f32
--- /dev/null
+++ b/data/rooms/00-00-04
@@ -0,0 +1,14 @@
+# Top of ventilation shaft
+
+connected 00 00 00
+connected 00 00 01
+connected 00 00 02
+connected 00 00 03
+connected 00 01 04
+connected 00 02 04
+
+wallw -5.0 0.0 0.0
+walle 5.0 0.0 0.0
+walls 0.0 -5.0 0.0
+ceiling 0.0 0.0 5.0
+
diff --git a/data/rooms/00-01-04 b/data/rooms/00-01-04
new file mode 100644
index 0000000..5d62f68
--- /dev/null
+++ b/data/rooms/00-01-04
@@ -0,0 +1,14 @@
+# Top of ventilation shaft, heading north
+
+connected 00 00 00
+connected 00 00 01
+connected 00 00 02
+connected 00 00 03
+connected 00 00 04
+connected 00 02 04
+
+wallw -5.0 0.0 0.0
+walle 5.0 0.0 0.0
+ceiling 0.0 0.0 5.0
+tiledfloor 0.0 0.0 -5.0
+
diff --git a/data/rooms/00-02-04 b/data/rooms/00-02-04
new file mode 100644
index 0000000..6195e34
--- /dev/null
+++ b/data/rooms/00-02-04
@@ -0,0 +1,12 @@
+# Top of ventilation shaft, heading north some more
+
+connected 00 00 03
+connected 00 00 04
+connected 00 01 04
+
+walln 0.0 5.0 0.0
+wallw -5.0 0.0 0.0
+walle 5.0 0.0 0.0
+ceiling 0.0 0.0 5.0
+tiledfloor 0.0 0.0 -5.0
+
diff --git a/data/shaders/lighting.frag b/data/shaders/lighting.frag
new file mode 100644
index 0000000..ee1df5b
--- /dev/null
+++ b/data/shaders/lighting.frag
@@ -0,0 +1,53 @@
+/*
+ * lighting.frag
+ *
+ * Lighting calculations
+ *
+ * (c) 2007-2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+varying vec4 col_ambi;
+varying vec4 col_diff;
+varying vec4 col_spec;
+varying vec4 col_emit;
+varying float shininess;
+
+varying vec3 normal;
+varying vec3 halfvc;
+
+uniform sampler2D texture;
+
+void main() {
+
+ vec4 ambi;
+ vec4 diff;
+ vec4 spec;
+ vec3 light;
+ vec3 norml;
+
+ /* Ambient contribution */
+ ambi = col_ambi * gl_LightModel.ambient;
+ ambi += col_ambi * gl_LightSource[0].ambient;
+ ambi = vec4(0.0, 0.0, 0.0, 1.0);
+
+ /* Diffuse contribution */
+ light = vec3(normalize(gl_LightSource[0].position));
+ norml = normalize(normal);
+ diff = col_diff * clamp(dot(light, normal), 0.0, 1.0);
+
+ /* Specular contribution */
+ spec = col_spec * clamp(pow(dot( vec3(normal), halfvc ), shininess), 0.0, 1.0);
+ spec = vec4(0.0, 0.0, 0.0, 1.0);
+
+ gl_FragColor = vec4(min(col_emit.r + ambi.r + diff.r + spec.r, 1.0),
+ min(col_emit.g + ambi.g + diff.g + spec.g, 1.0),
+ min(col_emit.b + ambi.b + diff.b + spec.b, 1.0),
+ min(col_emit.a + ambi.a + diff.a + spec.a, 1.0));
+
+ gl_FragColor *= texture2D(texture, gl_TexCoord[0].st);
+
+}
+
diff --git a/data/shaders/lighting.vert b/data/shaders/lighting.vert
new file mode 100644
index 0000000..eaa51c2
--- /dev/null
+++ b/data/shaders/lighting.vert
@@ -0,0 +1,39 @@
+/*
+ * lighting.vert
+ *
+ * Lighting calculations
+ *
+ * (c) 2007-2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+varying vec4 col_ambi;
+varying vec4 col_diff;
+varying vec4 col_spec;
+varying vec4 col_emit;
+varying float shininess;
+
+varying vec3 normal;
+varying vec3 halfvc;
+
+void main() {
+
+ /* Directions */
+ normal = normalize(gl_NormalMatrix * gl_Normal);
+ halfvc = vec3(gl_LightSource[0].halfVector);
+
+ /* Material properties */
+ col_ambi = gl_FrontMaterial.ambient;
+ col_diff = gl_FrontMaterial.diffuse;
+ col_spec = gl_FrontMaterial.specular;
+ col_emit = gl_FrontMaterial.emission;
+ shininess = gl_FrontMaterial.shininess;
+
+ /* Coordinates */
+ gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = ftransform();
+
+}
+
diff --git a/data/textures/floor1.png b/data/textures/floor1.png
new file mode 100644
index 0000000..5a11e7e
--- /dev/null
+++ b/data/textures/floor1.png
Binary files differ
diff --git a/data/textures/tiledwall.png b/data/textures/tiledwall.png
new file mode 100644
index 0000000..7138440
--- /dev/null
+++ b/data/textures/tiledwall.png
Binary files differ
diff --git a/depcomp b/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+ stat=$?
+
+ if test -f "$tmpdepfile"; then :
+ else
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
+ tmpdepfile="$stripped.u"
+ fi
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ outname="$stripped.o"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..4d4a951
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c (ignored)
+-d create directories instead of installing files.
+-g GROUP $chgrpprog installed files to GROUP.
+-m MODE $chmodprog installed files to MODE.
+-o USER $chownprog installed files to USER.
+-s $stripprog installed files.
+-t DIRECTORY install into DIRECTORY.
+-T report an error if DSTFILE is a directory.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
+
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
+done
+
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ mkdircmd=:
+ chmodcmd=
+ else
+ mkdircmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ shift
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp"
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test -d "$pathcomp" || exit
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $mkdircmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ dstfile=`basename "$dst"`
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Copy the file name to the temp name.
+ $doit $cpprog "$src" "$dsttmp" &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit 1
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
+ fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+ (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/missing b/missing
new file mode 100755
index 0000000..894e786
--- /dev/null
+++ b/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/modelling/lander.blend b/modelling/lander.blend
new file mode 100644
index 0000000..c8d03fb
--- /dev/null
+++ b/modelling/lander.blend
Binary files differ
diff --git a/modelling/lander.blend.mtl b/modelling/lander.blend.mtl
new file mode 100644
index 0000000..fe83fbb
--- /dev/null
+++ b/modelling/lander.blend.mtl
@@ -0,0 +1,2 @@
+# Blender3D MTL File: lander.blend
+# Material Count: 0
diff --git a/modelling/lander.blend.obj b/modelling/lander.blend.obj
new file mode 100644
index 0000000..e716d74
--- /dev/null
+++ b/modelling/lander.blend.obj
@@ -0,0 +1,27 @@
+# Blender3D v244 OBJ File: lander.blend
+# www.blender3d.org
+mtllib lander.blend.mtl
+o Cube.006_Cube
+v -1.918875 2.667195 0.609982
+v -1.918875 2.667195 2.609982
+v -3.918875 2.667195 2.609982
+v -3.918875 2.667195 0.609982
+v -1.918875 4.667194 0.609982
+v -1.918876 4.667195 2.609982
+v -3.918875 4.667195 2.609982
+v -3.918875 4.667194 0.609982
+usemtl (null)
+usemtl (null)
+s 1
+f 5 1 8
+f 1 4 8
+f 3 7 8
+f 3 8 4
+f 2 6 3
+f 6 7 3
+f 1 5 2
+f 5 6 2
+f 5 8 7
+f 5 7 6
+f 1 2 3
+f 1 3 4
diff --git a/modelling/lander.blend1 b/modelling/lander.blend1
new file mode 100644
index 0000000..9def265
--- /dev/null
+++ b/modelling/lander.blend1
Binary files differ
diff --git a/modelling/lander.old b/modelling/lander.old
new file mode 100644
index 0000000..56b6532
--- /dev/null
+++ b/modelling/lander.old
@@ -0,0 +1,348 @@
+# Moon lander spacecraft thingy
+
+QUADS
+colour 0.0 0.5 0.2
+# Lower left foot
+ -0.25 -0.30 0.05
+ -0.25 -0.30 0.00
+ -0.15 -0.30 0.00
+ -0.15 -0.30 0.05
+ -0.15 -0.30 0.05
+ -0.15 -0.30 0.00
+ -0.10 -0.25 0.00
+ -0.10 -0.25 0.05
+ -0.10 -0.25 0.05
+ -0.10 -0.25 0.00
+ -0.10 -0.15 0.00
+ -0.10 -0.15 0.05
+ -0.10 -0.15 0.05
+ -0.10 -0.15 0.00
+ -0.15 -0.10 0.00
+ -0.15 -0.10 0.05
+ -0.15 -0.10 0.05
+ -0.15 -0.10 0.00
+ -0.25 -0.10 0.00
+ -0.25 -0.10 0.05
+ -0.25 -0.10 0.05
+ -0.25 -0.10 0.00
+ -0.30 -0.15 0.00
+ -0.30 -0.15 0.05
+ -0.30 -0.15 0.05
+ -0.30 -0.15 0.00
+ -0.30 -0.25 0.00
+ -0.30 -0.25 0.05
+ -0.30 -0.25 0.05
+ -0.30 -0.25 0.00
+ -0.25 -0.30 0.00
+ -0.25 -0.30 0.05
+# Lower right foot
+ 0.25 -0.30 0.00
+ 0.25 -0.30 0.05
+ 0.15 -0.30 0.05
+ 0.15 -0.30 0.00
+ 0.15 -0.30 0.00
+ 0.15 -0.30 0.05
+ 0.10 -0.25 0.05
+ 0.10 -0.25 0.00
+ 0.10 -0.25 0.00
+ 0.10 -0.25 0.05
+ 0.10 -0.15 0.05
+ 0.10 -0.15 0.00
+ 0.10 -0.15 0.00
+ 0.10 -0.15 0.05
+ 0.15 -0.10 0.05
+ 0.15 -0.10 0.00
+ 0.15 -0.10 0.00
+ 0.15 -0.10 0.05
+ 0.25 -0.10 0.05
+ 0.25 -0.10 0.00
+ 0.25 -0.10 0.00
+ 0.25 -0.10 0.05
+ 0.30 -0.15 0.05
+ 0.30 -0.15 0.00
+ 0.30 -0.15 0.00
+ 0.30 -0.15 0.05
+ 0.30 -0.25 0.05
+ 0.30 -0.25 0.00
+ 0.30 -0.25 0.00
+ 0.30 -0.25 0.05
+ 0.25 -0.30 0.05
+ 0.25 -0.30 0.00
+# Upper left foot
+ -0.25 0.30 0.00
+ -0.25 0.30 0.05
+ -0.15 0.30 0.05
+ -0.15 0.30 0.00
+ -0.15 0.30 0.00
+ -0.15 0.30 0.05
+ -0.10 0.25 0.05
+ -0.10 0.25 0.00
+ -0.10 0.25 0.00
+ -0.10 0.25 0.05
+ -0.10 0.15 0.05
+ -0.10 0.15 0.00
+ -0.10 0.15 0.00
+ -0.10 0.15 0.05
+ -0.15 0.10 0.05
+ -0.15 0.10 0.00
+ -0.15 0.10 0.00
+ -0.15 0.10 0.05
+ -0.25 0.10 0.05
+ -0.25 0.10 0.00
+ -0.25 0.10 0.00
+ -0.25 0.10 0.05
+ -0.30 0.15 0.05
+ -0.30 0.15 0.00
+ -0.30 0.15 0.00
+ -0.30 0.15 0.05
+ -0.30 0.25 0.05
+ -0.30 0.25 0.00
+ -0.30 0.25 0.00
+ -0.30 0.25 0.05
+ -0.25 0.30 0.05
+ -0.25 0.30 0.00
+# Upper right foot
+ 0.25 0.30 0.05
+ 0.25 0.30 0.00
+ 0.15 0.30 0.00
+ 0.15 0.30 0.05
+ 0.15 0.30 0.05
+ 0.15 0.30 0.00
+ 0.10 0.25 0.00
+ 0.10 0.25 0.05
+ 0.10 0.25 0.05
+ 0.10 0.25 0.00
+ 0.10 0.15 0.00
+ 0.10 0.15 0.05
+ 0.10 0.15 0.05
+ 0.10 0.15 0.00
+ 0.15 0.10 0.00
+ 0.15 0.10 0.05
+ 0.15 0.10 0.05
+ 0.15 0.10 0.00
+ 0.25 0.10 0.00
+ 0.25 0.10 0.05
+ 0.25 0.10 0.05
+ 0.25 0.10 0.00
+ 0.30 0.15 0.00
+ 0.30 0.15 0.05
+ 0.30 0.15 0.05
+ 0.30 0.15 0.00
+ 0.30 0.25 0.00
+ 0.30 0.25 0.05
+ 0.30 0.25 0.05
+ 0.30 0.25 0.00
+ 0.25 0.30 0.00
+ 0.25 0.30 0.05
+
+TRIANGLES
+colour 0.0 0.5 0.2
+# Upper right foot, bottom panel
+ 0.20 0.20 0.00
+ 0.25 0.10 0.00
+ 0.15 0.10 0.00
+ 0.20 0.20 0.00
+ 0.15 0.10 0.00
+ 0.10 0.15 0.00
+ 0.20 0.20 0.00
+ 0.10 0.15 0.00
+ 0.10 0.25 0.00
+ 0.20 0.20 0.00
+ 0.10 0.25 0.00
+ 0.15 0.30 0.00
+ 0.20 0.20 0.00
+ 0.15 0.30 0.00
+ 0.25 0.30 0.00
+ 0.20 0.20 0.00
+ 0.25 0.30 0.00
+ 0.30 0.25 0.00
+ 0.20 0.20 0.00
+ 0.30 0.25 0.00
+ 0.30 0.15 0.00
+ 0.20 0.20 0.00
+ 0.30 0.15 0.00
+ 0.25 0.10 0.00
+# Upper left foot, bottom panel
+ -0.20 0.20 0.00
+ -0.15 0.10 0.00
+ -0.25 0.10 0.00
+ -0.20 0.20 0.00
+ -0.10 0.15 0.00
+ -0.15 0.10 0.00
+ -0.20 0.20 0.00
+ -0.10 0.25 0.00
+ -0.10 0.15 0.00
+ -0.20 0.20 0.00
+ -0.15 0.30 0.00
+ -0.10 0.25 0.00
+ -0.20 0.20 0.00
+ -0.25 0.30 0.00
+ -0.15 0.30 0.00
+ -0.20 0.20 0.00
+ -0.30 0.25 0.00
+ -0.25 0.30 0.00
+ -0.20 0.20 0.00
+ -0.30 0.15 0.00
+ -0.30 0.25 0.00
+ -0.20 0.20 0.00
+ -0.25 0.10 0.00
+ -0.30 0.15 0.00
+# Lower left foot, bottom panel
+ -0.20 -0.20 0.00
+ -0.25 -0.10 0.00
+ -0.15 -0.10 0.00
+ -0.20 -0.20 0.00
+ -0.15 -0.10 0.00
+ -0.10 -0.15 0.00
+ -0.20 -0.20 0.00
+ -0.10 -0.15 0.00
+ -0.10 -0.25 0.00
+ -0.20 -0.20 0.00
+ -0.10 -0.25 0.00
+ -0.15 -0.30 0.00
+ -0.20 -0.20 0.00
+ -0.15 -0.30 0.00
+ -0.25 -0.30 0.00
+ -0.20 -0.20 0.00
+ -0.25 -0.30 0.00
+ -0.30 -0.25 0.00
+ -0.20 -0.20 0.00
+ -0.30 -0.25 0.00
+ -0.30 -0.15 0.00
+ -0.20 -0.20 0.00
+ -0.30 -0.15 0.00
+ -0.25 -0.10 0.00
+# Lower right foot, bottom panel
+ 0.20 -0.20 0.00
+ 0.15 -0.10 0.00
+ 0.25 -0.10 0.00
+ 0.20 -0.20 0.00
+ 0.10 -0.15 0.00
+ 0.15 -0.10 0.00
+ 0.20 -0.20 0.00
+ 0.10 -0.25 0.00
+ 0.10 -0.15 0.00
+ 0.20 -0.20 0.00
+ 0.15 -0.30 0.00
+ 0.10 -0.25 0.00
+ 0.20 -0.20 0.00
+ 0.25 -0.30 0.00
+ 0.15 -0.30 0.00
+ 0.20 -0.20 0.00
+ 0.30 -0.25 0.00
+ 0.25 -0.30 0.00
+ 0.20 -0.20 0.00
+ 0.30 -0.15 0.00
+ 0.30 -0.25 0.00
+ 0.20 -0.20 0.00
+ 0.25 -0.10 0.00
+ 0.30 -0.15 0.00
+# Upper right foot, top panel
+ 0.20 0.20 0.05
+ 0.15 0.10 0.05
+ 0.25 0.10 0.05
+ 0.20 0.20 0.05
+ 0.10 0.15 0.05
+ 0.15 0.10 0.05
+ 0.20 0.20 0.05
+ 0.10 0.25 0.05
+ 0.10 0.15 0.05
+ 0.20 0.20 0.05
+ 0.15 0.30 0.05
+ 0.10 0.25 0.05
+ 0.20 0.20 0.05
+ 0.25 0.30 0.05
+ 0.15 0.30 0.05
+ 0.20 0.20 0.05
+ 0.30 0.25 0.05
+ 0.25 0.30 0.05
+ 0.20 0.20 0.05
+ 0.30 0.15 0.05
+ 0.30 0.25 0.05
+ 0.20 0.20 0.05
+ 0.25 0.10 0.05
+ 0.30 0.15 0.05
+# Upper left foot, top panel
+ -0.20 0.20 0.05
+ -0.25 0.10 0.05
+ -0.15 0.10 0.05
+ -0.20 0.20 0.05
+ -0.15 0.10 0.05
+ -0.10 0.15 0.05
+ -0.20 0.20 0.05
+ -0.10 0.15 0.05
+ -0.10 0.25 0.05
+ -0.20 0.20 0.05
+ -0.10 0.25 0.05
+ -0.15 0.30 0.05
+ -0.20 0.20 0.05
+ -0.15 0.30 0.05
+ -0.25 0.30 0.05
+ -0.20 0.20 0.05
+ -0.25 0.30 0.05
+ -0.30 0.25 0.05
+ -0.20 0.20 0.05
+ -0.30 0.25 0.05
+ -0.30 0.15 0.05
+ -0.20 0.20 0.05
+ -0.30 0.15 0.05
+ -0.25 0.10 0.05
+# Lower left foot, top panel
+ -0.20 -0.20 0.05
+ -0.15 -0.10 0.05
+ -0.25 -0.10 0.05
+ -0.20 -0.20 0.05
+ -0.10 -0.15 0.05
+ -0.15 -0.10 0.05
+ -0.20 -0.20 0.05
+ -0.10 -0.25 0.05
+ -0.10 -0.15 0.05
+ -0.20 -0.20 0.05
+ -0.15 -0.30 0.05
+ -0.10 -0.25 0.05
+ -0.20 -0.20 0.05
+ -0.25 -0.30 0.05
+ -0.15 -0.30 0.05
+ -0.20 -0.20 0.05
+ -0.30 -0.25 0.05
+ -0.25 -0.30 0.05
+ -0.20 -0.20 0.05
+ -0.30 -0.15 0.05
+ -0.30 -0.25 0.05
+ -0.20 -0.20 0.05
+ -0.25 -0.10 0.05
+ -0.30 -0.15 0.05
+# Lower right foot, top panel
+ 0.20 -0.20 0.05
+ 0.25 -0.10 0.05
+ 0.15 -0.10 0.05
+ 0.20 -0.20 0.05
+ 0.15 -0.10 0.05
+ 0.10 -0.15 0.05
+ 0.20 -0.20 0.05
+ 0.10 -0.15 0.05
+ 0.10 -0.25 0.05
+ 0.20 -0.20 0.05
+ 0.10 -0.25 0.05
+ 0.15 -0.30 0.05
+ 0.20 -0.20 0.05
+ 0.15 -0.30 0.05
+ 0.25 -0.30 0.05
+ 0.20 -0.20 0.05
+ 0.25 -0.30 0.05
+ 0.30 -0.25 0.05
+ 0.20 -0.20 0.05
+ 0.30 -0.25 0.05
+ 0.30 -0.15 0.05
+ 0.20 -0.20 0.05
+ 0.30 -0.15 0.05
+ 0.25 -0.10 0.05
+
+QUADS
+colour 0.0 0.5 0.2
+# Front indicator
+ -0.10 0.30 0.05
+ 0.10 0.30 0.05
+ 0.10 0.35 0.05
+ -0.10 0.35 0.05
+
diff --git a/scripts/model.pl b/scripts/model.pl
new file mode 100755
index 0000000..04367b7
--- /dev/null
+++ b/scripts/model.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+open(FH, $ARGV[0]);
+
+while ( my $line = <FH> ) {
+
+ chomp $line;
+
+ if ( $line =~ /^\s*([0-9,\.\-]+)\s+([0-9,\.\-]+)\s+([0-9,\.\-]+)/ ) {
+
+ my $x = $1; my $y = $2; my $z = $3;
+
+ printf("%8.2f%8.2f%8.2f\n", $x/100.0, $y/100.0, $z/100.0);
+
+ } else {
+ printf("%s\n", $line);
+ }
+
+}
+
+close(FH);
+
+exit(0);
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..c6299b5
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,6 @@
+bin_PROGRAMS = thrust3d
+thrust3d_SOURCES = main.c model.c render.c physics.c game.c texture.c utils.c
+thrust3d_LDADD = @LIBS@
+AM_CFLAGS = -Wall -g
+AM_CPPFLAGS = -DDATADIR=\""$(datadir)"/thrust3d\"
+
diff --git a/src/game.c b/src/game.c
new file mode 100644
index 0000000..9f0ef0c
--- /dev/null
+++ b/src/game.c
@@ -0,0 +1,357 @@
+/*
+ * game.c
+ *
+ * Game book-keeping
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "types.h"
+#include "model.h"
+#include "game.h"
+#include "render.h"
+#include "utils.h"
+
+#define MAX_OBJECTS 100
+
+/* Maximum indicies of the rooms - remember they start at zero */
+#define MAX_ROOM_X 0
+#define MAX_ROOM_Y 2
+#define MAX_ROOM_Z 4
+
+static Room *room_new() {
+
+ Room *r;
+
+ r = malloc(sizeof(Room));
+ if ( r == NULL ) return NULL;
+
+ r->objects = malloc(MAX_OBJECTS*sizeof(ModelInstance *));
+ r->num_objects = 0;
+
+ r->num_connected = 0;
+ r->num_lights = 0;
+
+ return r;
+
+}
+
+static ModelInstance *room_add_object(Room *room, ModelContext *ctx, const char *name, GLfloat x, GLfloat y, GLfloat z,
+ ObjectAttrib attribs, RenderContext *render) {
+
+ if ( room->num_objects == MAX_OBJECTS ) return NULL;
+
+ room->objects[room->num_objects] = model_instance_new(ctx, name, render);
+
+ if ( room->objects[room->num_objects] != NULL ) {
+ room->objects[room->num_objects]->x = x;
+ room->objects[room->num_objects]->y = y;
+ room->objects[room->num_objects]->z = z;
+ room->objects[room->num_objects]->attribs = attribs;
+ }
+
+ room->num_objects++;
+
+ return room->objects[room->num_objects-1];
+
+}
+
+static Room *room_load(int rx, int ry, int rz, ModelContext *models, RenderContext *render) {
+
+ Room *r;
+ char tmp[64];
+ FILE *fh;
+
+ snprintf(tmp, 63, "%s/rooms/%02i-%02i-%02i", DATADIR, rx, ry, rz);
+ fh = fopen(tmp, "r");
+ if ( fh == NULL ) {
+ fprintf(stderr, "Couldn't load room '%s'\n", tmp);
+ return NULL;
+ }
+
+ r = room_new();
+ if ( r == NULL ) return NULL;
+ r->rx = rx;
+ r->ry = ry;
+ r->rz = rz;
+
+ while ( !feof(fh) ) {
+
+ int i;
+ char line[1024];
+ GLfloat x, y, z;
+ int rx, ry, rz;
+
+ fgets(line, 1023, fh);
+
+ if ( line[0] == '#' ) {
+ continue;
+ }
+
+ for ( i=0; i<strlen(line); i++ ) {
+ if ( line[i] == ' ' ) break;
+ }
+ if ( i >= strlen(line) ) continue;
+ line[i] = '\0'; /* "line" is now the model name */
+ for ( i=strlen(line)+1; i<strlen(line+strlen(line)); i++ ) { /* Ugh. */
+ if ( line[i] != ' ' ) break;
+ }
+
+ if ( (strcmp(line, "connected") == 0) && (sscanf(line+i, "%i %i %i", &rx, &ry, &rz) == 3) ) {
+ r->connected[r->num_connected].rx = rx;
+ r->connected[r->num_connected].ry = ry;
+ r->connected[r->num_connected].rz = rz;
+ r->num_connected++;
+ } else if ( (strcmp(line, "light") == 0) && (sscanf(line+i, "%f %f %f", &x, &y, &z) == 3) ) {
+ r->lights[r->num_lights].x = x;
+ r->lights[r->num_lights].y = y;
+ r->lights[r->num_lights].z = z;
+ r->num_lights++;
+ } else if ( sscanf(line+i, "%f %f %f", &x, &y, &z) == 3 ) {
+ room_add_object(r, models, line, x, y, z, OBJ_NONE, render);
+ }
+
+ }
+
+ fclose(fh);
+
+ r->needed_this_time = 1;
+ return r;
+
+}
+
+Room *game_find_room(Game *game, int rx, int ry, int rz) {
+
+ int i;
+
+ for ( i=0; i<game->num_rooms; i++ ) {
+ if ( ( game->rooms[i]->rx == rx ) && ( game->rooms[i]->ry == ry ) && ( game->rooms[i]->rz == rz ) ) {
+ return game->rooms[i];
+ }
+ }
+
+ return NULL;
+
+}
+
+static void game_delete_room(Game *game, int idx) {
+
+ int i;
+ Room *room;
+
+ room = game->rooms[idx];
+
+ for ( i=0; i<room->num_objects; i++ ) {
+ free(room->objects[i]);
+ }
+ free(room->objects);
+ free(room);
+
+ /* Shift the list up one place */
+ for ( i=idx+1; i<game->num_rooms; i++ ) {
+ game->rooms[i-1] = game->rooms[i];
+ }
+
+ game->num_rooms--;
+
+}
+
+/* Load the current room and all rooms causally connected */
+static void game_load_all_connected(Game *game) {
+
+ int i;
+ Room *room;
+
+ /* Go down the current list of rooms, setting 'needed_this_time' to 0 */
+ for ( i=0; i<game->num_rooms; i++ ) {
+ game->rooms[i]->needed_this_time = 0;
+ }
+
+ /* Is the current room in the list? Load it if not */
+ room = game_find_room(game, game->cur_room_x, game->cur_room_y, game->cur_room_z);
+ if ( room == NULL ) {
+ room = room_load(game->cur_room_x, game->cur_room_y, game->cur_room_z, game->models, game->render);
+ if ( room == NULL ) {
+ /* This room couldn't be loaded. */
+ return;
+ }
+ game->rooms[game->num_rooms] = room;
+ game->num_rooms++;
+ }
+ room->needed_this_time = 1;
+
+ /* Check that all connected rooms are loaded as well */
+ for ( i=0; i<room->num_connected; i++ ) {
+
+ Room *con;
+ int rx, ry, rz;
+
+ rx = room->connected[i].rx;
+ ry = room->connected[i].ry;
+ rz = room->connected[i].rz;
+ con = game_find_room(game, rx, ry, rz);
+ if ( con == NULL ) {
+ game->rooms[game->num_rooms] = room_load(rx, ry, rz, game->models, game->render);
+ game->num_rooms++;
+ } else {
+ con->needed_this_time = 1;
+ }
+
+ }
+
+ /* Remove any rooms left in the list which are no longer needed */
+ for ( i=0; i<game->num_rooms; i++ ) {
+ if ( !game->rooms[i]->needed_this_time ) {
+ game_delete_room(game, i);
+ }
+ }
+
+}
+
+/* Create a new "game" structure */
+Game *game_new() {
+
+ Game *g;
+
+ g = malloc(sizeof(Game));
+ if ( g == NULL ) return NULL;
+
+ g->thrusting = 0;
+ g->turn_left = 0;
+ g->turn_right = 0;
+ g->forward = 0;
+ g->reverse = 0;
+ g->tlast = 0;
+ g->cur_room_x = 0;
+ g->cur_room_y = 0;
+ g->cur_room_z = 0;
+ g->num_rooms = 0;
+ g->view_angle = deg2rad(+20.0);
+ g->paused = 0;
+ g->pause_rel = 1;
+
+ /* Renderer setup */
+ g->render = render_setup();
+ if ( g->render == NULL ) {
+ fprintf(stderr, "Couldn't initialise renderer\n");
+ free(g);
+ return NULL;
+ }
+
+ /* Load models */
+ g->models = model_init();
+ if ( g->models == NULL ) {
+ fprintf(stderr, "Couldn't create model context\n");
+ render_shutdown(g->render);
+ free(g);
+ return NULL;
+ }
+
+ game_load_all_connected(g);
+
+ /* Initialise the craft */
+ g->lander = model_instance_new(g->models, "lander", g->render);
+ g->lander->x = 0.0;
+ g->lander->y = 0.0;
+ g->lander->z = -4.95;
+ g->lander->attribs = OBJ_GRAVITY;
+
+ return g;
+
+}
+
+/* Check if the player needs to be moved to another room */
+void game_check_handoff(Game *game) {
+
+ /* x-axis handoff */
+ if ( game->lander->x > 5.0 ) {
+ if ( game->cur_room_x >= MAX_ROOM_X ) {
+ game->lander->x = 5.0;
+ game->lander->vx = 0.0;
+ } else {
+ game->lander->x -= 10.0;
+ game->cur_room_x += 1;
+ game_load_all_connected(game);
+ }
+ }
+ if ( game->lander->x < -5.0 ) {
+ if ( game->cur_room_x <= 0 ) {
+ game->lander->x = -5.0;
+ game->lander->vx = 0.0;
+ } else {
+ game->lander->x += 10.0;
+ game->cur_room_x -= 1;
+ game_load_all_connected(game);
+ }
+ }
+
+ /* y-axis handoff */
+ if ( game->lander->y > 5.0 ) {
+ if ( game->cur_room_y >= MAX_ROOM_Y ) {
+ game->lander->y = 5.0;
+ game->lander->vy = 0.0;
+ } else {
+ game->lander->y -= 10.0;
+ game->cur_room_y += 1;
+ game_load_all_connected(game);
+ }
+ }
+ if ( game->lander->y < -5.0 ) {
+ if ( game->cur_room_y <= 0 ) {
+ game->lander->y = -5.0;
+ game->lander->vy = 0.0;
+ } else {
+ game->lander->y += 10.0;
+ game->cur_room_y -= 1;
+ game_load_all_connected(game);
+ }
+ }
+
+ /* z-axis handoff */
+ if ( game->lander->z > 5.0 ) {
+ if ( game->cur_room_z >= MAX_ROOM_Z ) {
+ game->lander->z = 5.0;
+ game->lander->vz = 0.0;
+ } else {
+ game->lander->z -= 10.0;
+ game->cur_room_z += 1;
+ game_load_all_connected(game);
+ }
+ }
+ if ( game->lander->z < -5.0 ) {
+ if ( game->cur_room_z <= 0 ) {
+ game->lander->z = -5.0;
+ game->lander->vz = 0.0;
+ } else {
+ game->lander->z += 10.0;
+ game->cur_room_z -= 1;
+ game_load_all_connected(game);
+ }
+ }
+
+}
+
+void game_pause(Game *game) {
+
+ if ( game->pause_rel == 0 ) return;
+
+ if ( game->paused ) {
+ game->paused = 0;
+ game->tlast = SDL_GetTicks();
+ game->pause_rel = 0;
+ } else {
+ game->paused = 1;
+ game->pause_rel = 0;
+ }
+
+}
+
diff --git a/src/game.h b/src/game.h
new file mode 100644
index 0000000..d69562c
--- /dev/null
+++ b/src/game.h
@@ -0,0 +1,29 @@
+/*
+ * game.h
+ *
+ * Game book-keeping
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef GAME_H
+#define GAME_H
+
+#include <gl.h>
+
+#include "types.h"
+
+extern void game_check_handoff(Game *game);
+extern Game *game_new(void);
+extern Room *game_find_room(Game *game, int rx, int ry, int rz);
+extern void game_pause(Game *game);
+
+#endif /* GAME_H */
+
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..6d1e8b6
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,98 @@
+/*
+ * main.c
+ *
+ * Where it all begins
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <SDL.h>
+#include <gl.h>
+#include <glu.h>
+
+#include "types.h"
+#include "model.h"
+#include "game.h"
+#include "render.h"
+#include "physics.h"
+
+int main(int argc, char *argv[]) {
+
+ SDL_Event event;
+ int finished;
+ SDL_Surface *screen;
+
+ /* SDL initial setup */
+ if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0 ) {
+ fprintf(stderr, "Couldn't initialise SDL: %s\n", SDL_GetError());
+ return 1;
+ }
+ atexit(SDL_Quit);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ screen = SDL_SetVideoMode(640, 480, 16, SDL_OPENGL);
+ if (screen == NULL) {
+ fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
+ return 1;
+ }
+ SDL_WM_SetCaption("Thrust3D", "Thrust3D");
+
+ /* World setup */
+ Game *game;
+ game = game_new();
+
+ /* Main loop */
+ finished = 0;
+ while ( !finished ) {
+ SDL_PollEvent(&event);
+ switch ( event.type ) {
+ case SDL_KEYDOWN :
+ if ( !game->paused ) {
+ if ( event.key.keysym.sym == SDLK_SPACE ) game->thrusting = 1;
+ if ( event.key.keysym.sym == SDLK_LEFT ) game->turn_left = 1;
+ if ( event.key.keysym.sym == SDLK_RIGHT ) game->turn_right = 1;
+ if ( event.key.keysym.sym == SDLK_UP ) game->forward = 1;
+ if ( event.key.keysym.sym == SDLK_DOWN ) game->reverse = 1;
+ }
+ if ( event.key.keysym.sym == SDLK_p ) game_pause(game);
+ break;
+ case SDL_KEYUP :
+ if ( !game->paused ) {
+ if ( event.key.keysym.sym == SDLK_SPACE ) game->thrusting = 0;
+ if ( event.key.keysym.sym == SDLK_LEFT ) game->turn_left = 0;
+ if ( event.key.keysym.sym == SDLK_RIGHT ) game->turn_right = 0;
+ if ( event.key.keysym.sym == SDLK_UP ) game->forward = 0;
+ if ( event.key.keysym.sym == SDLK_DOWN ) game->reverse = 0;
+ }
+ if ( event.key.keysym.sym == SDLK_p ) game->pause_rel = 1;
+ break;
+ case SDL_VIDEOEXPOSE :
+ /* Don't bother redrawing if not paused - not long to wait! */
+ if ( game->paused ) render_draw(game);
+ break;
+ case SDL_QUIT :
+ finished = 1;
+ break;
+ }
+ if ( !game->paused ) {
+ physics_step(game);
+ render_draw(game);
+ }
+ }
+
+ render_shutdown(game->render);
+ SDL_Quit();
+
+ printf("\n");
+
+ return 0;
+
+}
+
diff --git a/src/model.c b/src/model.c
new file mode 100644
index 0000000..a10c55d
--- /dev/null
+++ b/src/model.c
@@ -0,0 +1,399 @@
+/*
+ * model.c
+ *
+ * Basic functions to handle models
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "types.h"
+#include "model.h"
+#include "utils.h"
+#include "texture.h"
+#include "render.h"
+
+/* Maximum number of vertices per primitive */
+#define MAX_VERTICES 256
+
+ModelContext *model_init() {
+
+ ModelContext *ctx;
+
+ ctx = malloc(sizeof(ModelContext));
+ if ( ctx == NULL ) return NULL;
+
+ ctx->num_models = 0;
+ ctx->models = NULL;
+
+ return ctx;
+
+}
+
+static int model_add(ModelContext *ctx, Model *model) {
+
+ ctx->models = realloc(ctx->models, (ctx->num_models+1)*sizeof(Model *));
+ if ( ctx->models == NULL ) {
+ return 1;
+ }
+ ctx->models[ctx->num_models] = model;
+ ctx->num_models++;
+
+ return 0;
+
+}
+
+static Model *model_new(const char *name) {
+
+ Model *model;
+
+ model = malloc(sizeof(Model));
+ if ( model == NULL ) return NULL;
+
+ model->num_primitives = 0;
+ model->attrib_total = ATTRIB_NONE;
+ model->primitives = NULL;
+ model->name = strdup(name);
+
+ return model;
+
+
+}
+
+static Primitive *model_add_primitive(Model *model, GLenum type, GLfloat *vertices, GLfloat *normals, GLfloat *texcoords,
+ int n, PrimitiveAttrib attribs, GLfloat r, GLfloat g, GLfloat b, char *texture) {
+
+ Primitive *p;
+
+ p = malloc(sizeof(Primitive));
+ if ( p == NULL ) return NULL;
+
+ p->vertices = malloc(n * sizeof(GLfloat) * 3);
+ if ( p->vertices == NULL ) {
+ free(p);
+ return NULL;
+ }
+
+ p->normals = malloc(n * sizeof(GLfloat) * 3);
+ if ( p->normals == NULL ) {
+ free(p);
+ free(p->vertices);
+ return NULL;
+ }
+
+ p->texcoords = malloc(n * sizeof(GLfloat) * 2);
+ if ( p->texcoords == NULL ) {
+ free(p);
+ free(p->vertices);
+ free(p->normals);
+ return NULL;
+ }
+
+ /* Copy the vertices into memory */
+ memcpy(p->vertices, vertices, 3*n*sizeof(GLfloat));
+ memcpy(p->normals, normals, 3*n*sizeof(GLfloat));
+ memcpy(p->texcoords, texcoords, 2*n*sizeof(GLfloat));
+ p->num_vertices = n;
+ p->type = type;
+ p->attribs = attribs;
+ p->col_r = r;
+ p->col_g = g;
+ p->col_b = b;
+ p->texture = texture;
+
+ model->attrib_total = model->attrib_total | attribs;
+ model->primitives = realloc(model->primitives, sizeof(Primitive *) * (model->num_primitives+1));
+ model->primitives[model->num_primitives] = p;
+ model->num_primitives++;
+
+ return 0;
+
+}
+
+static void model_calculate_normals(GLfloat *vertices, GLfloat *normals, int first, int last, int centre, int v1, int v2) {
+
+ GLfloat ax, ay, az;
+ GLfloat bx, by, bz;
+ GLfloat nx, ny, nz, n;
+ unsigned int i;
+
+ ax = vertices[3*v1+0] - vertices[3*centre+0];
+ ay = vertices[3*v1+1] - vertices[3*centre+1];
+ az = vertices[3*v1+2] - vertices[3*centre+2];
+ bx = vertices[3*v2+0] - vertices[3*centre+0];
+ by = vertices[3*v2+1] - vertices[3*centre+1];
+ bz = vertices[3*v2+2] - vertices[3*centre+2];
+ nx = ay*bz - az*by;
+ ny = - ax*bz + az*bx;
+ nz = ax*by - ay*bx;
+ n = sqrtf(nx*nx + ny*ny + nz*nz);
+ nx = nx / n; ny = ny / n; nz = nz / n;
+
+ for ( i=first; i<=last; i++ ) {
+ normals[3*i+0] = nx;
+ normals[3*i+1] = ny;
+ normals[3*i+2] = nz;
+ }
+
+}
+
+static int model_load_obj(ModelContext *ctx, const char *name, RenderContext *render) {
+
+ FILE *fh;
+ char tmp[64];
+ Model *model;
+ int num_vertices;
+ GLfloat *vertices;
+ GLfloat *normals;
+ GLfloat *texcoords;
+ GLfloat vtmp[3*MAX_VERTICES];
+ GLfloat vntmp[3*MAX_VERTICES];
+ int n_vtmp, n_vntmp;
+ char *texture;
+
+ snprintf(tmp, 63, "%s/models/%s.obj", DATADIR, name);
+ fh = fopen(tmp, "r");
+ if ( fh == NULL ) {
+ return -1;
+ }
+
+ model = model_new(name);
+ vertices = malloc(MAX_VERTICES*3*sizeof(GLfloat));
+ normals = malloc(MAX_VERTICES*3*sizeof(GLfloat));
+ texcoords = malloc(MAX_VERTICES*2*sizeof(GLfloat));
+ num_vertices = 0;
+ n_vtmp = 0;
+ texture = NULL;
+ while ( !feof(fh) ) {
+
+ char line[1024];
+ GLfloat x, y, z;
+ unsigned int v1, v2, v3;
+ GLfloat texx, texy;
+ size_t s;
+
+ texx = 0.0; texy = 0.0; /* Default texture coordinates */
+
+ fgets(line, 1023, fh);
+ s = 0;
+ for ( ; s<strlen(line); s++ ) {
+ if ( line[s] != ' ' ) break;
+ }
+
+ if ( line[s] == '#' ) {
+ continue;
+ }
+
+ if ( sscanf(line+s, "v %f %f %f\n", &x, &y, &z) == 3 ) {
+ vtmp[3*n_vtmp+0] = x;
+ vtmp[3*n_vtmp+1] = y;
+ vtmp[3*n_vtmp+2] = z;
+ n_vtmp++;
+ continue;
+ }
+
+ if ( sscanf(line+s, "vn %f %f %f\n", &x, &y, &z) == 3 ) {
+ vntmp[3*n_vntmp+0] = x;
+ vntmp[3*n_vntmp+1] = y;
+ vntmp[3*n_vntmp+2] = z;
+ n_vntmp++;
+ continue;
+ }
+
+ if ( line[s] == 'f' ) {
+ regex_t r;
+ regcomp(&r, "$f\s+([0-9\.]+)/([0-9\.]+)/([0-9\.]+)\s+^", 0);
+ regfree(&r);
+ }
+
+ }
+
+ fclose(fh);
+
+ return model_add(ctx, model);
+
+}
+
+static int model_load(ModelContext *ctx, const char *name, RenderContext *render) {
+
+ FILE *fh;
+ char tmp[64];
+ Model *model;
+ GLenum type;
+ int num_vertices;
+ GLfloat *vertices;
+ GLfloat *normals;
+ GLfloat *texcoords;
+ GLfloat col_r = 0.0;
+ GLfloat col_g = 0.0;
+ GLfloat col_b = 0.0;
+ PrimitiveAttrib attribs;
+ char *texture;
+
+ snprintf(tmp, 63, "%s/models/%s", DATADIR, name);
+ fh = fopen(tmp, "r");
+ if ( fh == NULL ) {
+ return -1;
+ }
+
+ model = model_new(name);
+ vertices = malloc(MAX_VERTICES*3*sizeof(GLfloat));
+ normals = malloc(MAX_VERTICES*3*sizeof(GLfloat));
+ texcoords = malloc(MAX_VERTICES*2*sizeof(GLfloat));
+ num_vertices = 0;
+ type = GL_TRIANGLES;
+ attribs = ATTRIB_NONE;
+ texture = NULL;
+ while ( !feof(fh) ) {
+
+ char line[1024];
+ GLfloat x, y, z;
+ GLfloat r, g, b;
+ GLfloat texx, texy, forget;
+
+ texx = 0.0; texy = 0.0; /* Default texture coordinates */
+
+ fgets(line, 1023, fh);
+
+ if ( line[0] == '#' ) {
+ continue;
+ }
+
+ if ( line[0] == '\n' ) {
+ if ( num_vertices > 0 ) {
+ model_add_primitive(model, type, vertices, normals, texcoords, num_vertices,
+ attribs, col_r, col_g, col_b, texture);
+ num_vertices = 0;
+ type = GL_TRIANGLES;
+ attribs = ATTRIB_NONE;
+ texture = NULL;
+ }
+ }
+
+ if ( strncmp(line, "QUADS", 5) == 0 ) {
+ type = GL_QUADS;
+ }
+ if ( strncmp(line, "TRIANGLES", 9) == 0 ) {
+ type = GL_TRIANGLES;
+ }
+
+ if ( sscanf(line, "%f %f %f %f %f", &forget, &forget, &forget, &x, &y) == 5 ) {
+ texx = x; texy = y;
+ }
+
+ if ( sscanf(line, "%f %f %f", &x, &y, &z) == 3 ) {
+ vertices[3*num_vertices+0] = x;
+ vertices[3*num_vertices+1] = y;
+ vertices[3*num_vertices+2] = z;
+ texcoords[2*num_vertices+0] = texx;
+ texcoords[2*num_vertices+1] = texy;
+ num_vertices++;
+ if ( (type == GL_QUADS) && ((num_vertices % 4)==0) ) {
+ model_calculate_normals(vertices, normals, num_vertices-4, num_vertices-1,
+ num_vertices-4, num_vertices-3, num_vertices-2);
+ }
+ if ( (type == GL_TRIANGLES) && ((num_vertices % 3)==0) ) {
+ model_calculate_normals(vertices, normals, num_vertices-3, num_vertices-1,
+ num_vertices-3, num_vertices-2, num_vertices-1);
+ }
+ if ( num_vertices > MAX_VERTICES ) {
+ fprintf(stderr, "Too many vertices in primitive\n");
+ return 1;
+ }
+ }
+
+ if ( sscanf(line, "pulse %f %f %f", &r, &g, &b) == 3 ) {
+ attribs = attribs | ATTRIB_COLOUR;
+ attribs = attribs | ATTRIB_PULSE;
+ col_r = r; col_g = g; col_b = b;
+ }
+ if ( sscanf(line, "colour %f %f %f", &r, &g, &b) == 3 ) {
+ attribs = attribs | ATTRIB_COLOUR;
+ col_r = r; col_g = g; col_b = b;
+ }
+ if ( strncmp(line, "texture", 7) == 0 ) {
+ if ( strlen(line) < 9 ) {
+ fprintf(stderr, "Invalid texture specification\n");
+ return 1;
+ }
+ texture = strdup(line+8);
+ chomp(texture);
+ if ( texture_lookup(render, texture) == NULL ) {
+ texture_load(render, texture);
+ if ( texture_lookup(render, texture) == NULL ) {
+ fprintf(stderr, "Couldn't find texture %s\n", texture);
+ }
+ }
+ }
+
+ }
+
+ fclose(fh);
+
+ return model_add(ctx, model);
+
+}
+
+static Model *model_lookup(ModelContext *ctx, const char *name) {
+
+ int i, found;
+
+ found = 0;
+ for ( i=0; i<ctx->num_models; i++ ) {
+ if ( strcmp(ctx->models[i]->name, name) == 0 ) {
+ found = 1;
+ break;
+ }
+ }
+
+ if ( found == 0 ) {
+ return NULL;
+ }
+
+ return ctx->models[i];
+}
+
+ModelInstance *model_instance_new(ModelContext *ctx, const char *name, RenderContext *render) {
+
+ ModelInstance *instance;
+
+ instance = malloc(sizeof(ModelInstance));
+ instance->model = model_lookup(ctx, name);
+
+ if ( instance->model == NULL ) {
+ /* Couldn't find model, so try to load it */
+ model_load(ctx, name, render);
+ instance->model = model_lookup(ctx, name);
+ if ( instance->model == NULL ) {
+ model_load_obj(ctx, name, render);
+ instance->model = model_lookup(ctx, name);
+ if ( instance->model == NULL ) {
+ free(instance);
+ printf("Couldn't find model %s\n", name);
+ return NULL;
+ }
+ }
+ }
+
+ instance->vx = 0.0;
+ instance->vy = 0.0;
+ instance->vz = 0.0;
+ instance->yaw = 0.0;
+ instance->yawspeed = 0.0;
+
+ return instance;
+
+}
+
diff --git a/src/model.h b/src/model.h
new file mode 100644
index 0000000..926e9b5
--- /dev/null
+++ b/src/model.h
@@ -0,0 +1,25 @@
+/*
+ * model.h
+ *
+ * Basic functions to handle models
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef MODEL_H
+#define MODEL_H
+
+#include "types.h"
+
+extern ModelContext *model_init(void);
+extern ModelInstance *model_instance_new(ModelContext *ctx, const char *name, RenderContext *render);
+
+#endif /* MODEL_H */
+
diff --git a/src/physics.c b/src/physics.c
new file mode 100644
index 0000000..555e13b
--- /dev/null
+++ b/src/physics.c
@@ -0,0 +1,148 @@
+/*
+ * physics.c
+ *
+ * Calculate what happens
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <SDL.h>
+#include <math.h>
+
+#include "types.h"
+#include "model.h"
+#include "game.h"
+#include "utils.h"
+
+/* Acceleration due to gravity in metres per millisecond per millisecond */
+#define GRAVITY (9.81e-6)
+
+/* Acceleration due to booster rocket, metres per ms per ms */
+#define THRUST (GRAVITY*2)
+
+/* Acceleration due to forwards/backwards thrusters, m per ms per ms */
+#define FTHRUST (GRAVITY*0.5)
+
+/* Air friction in (m per ms per ms) per (m per ms) */
+#define FRICTION 0.0008
+
+/* Lander craft turning speed in radians per ms per ms */
+#define YAWTHRUST (M_PI/3000000)
+
+/* Conversion factor between friction and 'yawthrust' */
+#define TORQUE 1
+
+static void physics_process(ModelInstance *obj, Uint32 dt) {
+
+ /* Air friction */
+ if ( obj->vx > 0.0 ) {
+ obj->vx -= FRICTION * dt * obj->vx;
+ if ( obj->vx < 0.0 ) obj->vx = 0.0;
+ } else {
+ obj->vx += FRICTION * dt * -obj->vx;
+ if ( obj->vx > 0.0 ) obj->vx = 0.0;
+ }
+
+ if ( obj->vy > 0.0 ) {
+ obj->vy -= FRICTION * dt * obj->vy;
+ if ( obj->vy < 0.0 ) obj->vy = 0.0;
+ } else {
+ obj->vy += FRICTION * dt * -obj->vy;
+ if ( obj->vy > 0.0 ) obj->vy = 0.0;
+ }
+
+ if ( obj->vz > 0.0 ) {
+ obj->vz -= FRICTION * dt * obj->vz;
+ if ( obj->vz < 0.0 ) obj->vz = 0.0;
+ } else {
+ obj->vz += FRICTION * dt * -obj->vz;
+ if ( obj->vz > 0.0 ) obj->vz = 0.0;
+ }
+
+ if ( obj->yawspeed > 0.0 ) {
+ obj->yawspeed -= FRICTION * dt * obj->yawspeed * TORQUE;
+ if ( obj->yawspeed < 0.0 ) obj->yawspeed = 0.0;
+ } else {
+ obj->yawspeed += FRICTION * dt * -obj->yawspeed * TORQUE;
+ if ( obj->yawspeed > 0.0 ) obj->yawspeed = 0.0;
+ }
+
+ /* Gravity */
+ if ( obj->attribs & OBJ_GRAVITY ) obj->vz -= GRAVITY * dt;
+
+ /* Take a step */
+ obj->x += obj->vx * dt;
+ obj->y += obj->vy * dt;
+ obj->z += obj->vz * dt;
+ obj->yaw += obj->yawspeed * dt;
+
+ if ( obj->yaw < -M_PI ) obj->yaw += 2*M_PI;
+ if ( obj->yaw > M_PI ) obj->yaw -= 2*M_PI;
+
+}
+
+void physics_step(Game *game) {
+
+ int i, j;
+ Uint32 dt, t;
+
+ t = SDL_GetTicks();
+ dt = t - game->tlast;
+
+ /* Handle things specific to the lander craft */
+ if ( game->thrusting ) {
+ game->lander->vz += THRUST * dt;
+ }
+ if ( game->forward ) {
+ game->lander->vx += sinf(game->lander->yaw) * FTHRUST * dt;
+ game->lander->vy += cosf(game->lander->yaw) * FTHRUST * dt;
+ } else if ( game->reverse ) {
+ game->lander->vx -= sinf(game->lander->yaw) * FTHRUST * dt;
+ game->lander->vy -= cosf(game->lander->yaw) * FTHRUST * dt;
+ }
+ if ( game->turn_left ) {
+ game->lander->yawspeed -= YAWTHRUST * dt; /* -ve yaw is "left" */
+ }
+ if ( game->turn_right ) {
+ game->lander->yawspeed += YAWTHRUST *dt; /* +ve yaw is "right" */
+ }
+ physics_process(game->lander, dt);
+ game_check_handoff(game);
+ printf("%+7.4f %+7.4f %+7.4f %+5.1f deg %+7.5f %+7.5f %+7.5f %2i %2i %2i %3i %3i fps\r",
+ game->lander->x, game->lander->y, game->lander->z,
+ rad2deg(game->lander->yaw), game->lander->vx, game->lander->vy, game->lander->vz,
+ game->cur_room_x, game->cur_room_y, game->cur_room_z, game->num_rooms, game->render->fps);
+ fflush(stdout);
+
+ for ( j=0; j<game->num_rooms; j++ ) {
+
+ Room *room;
+
+ room = game->rooms[j];
+ if ( room == NULL ) return;
+ for ( i=0; i<room->num_objects; i++ ) {
+
+ ModelInstance *obj;
+
+ obj = room->objects[i];
+ if ( obj == NULL ) continue;
+
+ physics_process(obj, dt);
+
+ }
+
+ }
+
+ //game->view_angle = deg2rad(30.0 - 30.0 * game->lander->vz/0.015);
+
+ game->tlast = t;
+
+}
+
diff --git a/src/physics.h b/src/physics.h
new file mode 100644
index 0000000..c1ead94
--- /dev/null
+++ b/src/physics.h
@@ -0,0 +1,24 @@
+/*
+ * physics.h
+ *
+ * Calculate what happens
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef PHYSICS_H
+#define PHYSICS_H
+
+#include "types.h"
+
+extern void physics_step(Game *game);
+
+#endif /* PHYSICS_H */
+
diff --git a/src/render.c b/src/render.c
new file mode 100644
index 0000000..df3862b
--- /dev/null
+++ b/src/render.c
@@ -0,0 +1,333 @@
+/*
+ * render.c
+ *
+ * Render the scene
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define GL_GLEXT_PROTOTYPES 1
+#include <gl.h>
+#include <glext.h>
+#include <SDL.h>
+#include <glu.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "model.h"
+#include "game.h"
+#include "render.h"
+#include "texture.h"
+#include "utils.h"
+
+/* Utility function to load and compile a shader, checking the info log */
+static GLhandleARB render_load_shader(const char *filename, GLenum type) {
+
+ GLhandleARB shader;
+ char text[4096];
+ size_t len;
+ FILE *fh;
+ int l;
+
+ fh = fopen(filename, "r");
+ if ( fh == NULL ) {
+ fprintf(stderr, "Couldn't load shader '%s'\n", filename);
+ return 0;
+ }
+ len = fread(text, 1, 4095, fh);
+ fclose(fh);
+ text[len] = '\0';
+ const GLcharARB *source = text;
+ shader = glCreateShaderObjectARB(type);
+ glShaderSourceARB(shader, 1, &source, NULL);
+ glCompileShaderARB(shader);
+ glGetInfoLogARB(shader, 4095, &l, text);
+ if ( l > 0 ) {
+ printf("%s\n", text); fflush(stdout);
+ }
+
+ return shader;
+
+}
+
+static void render_load_shaders(RenderContext *ctx) {
+
+ ctx->lighting_vert = render_load_shader(DATADIR"/shaders/lighting.vert", GL_VERTEX_SHADER_ARB);
+ ctx->lighting_frag = render_load_shader(DATADIR"/shaders/lighting.frag", GL_FRAGMENT_SHADER_ARB);
+ ctx->lighting_program = glCreateProgramObjectARB();
+ glAttachObjectARB(ctx->lighting_program, ctx->lighting_vert);
+ glAttachObjectARB(ctx->lighting_program, ctx->lighting_frag);
+ glLinkProgramARB(ctx->lighting_program);
+
+}
+
+static void render_delete_shaders(RenderContext *ctx) {
+
+ glDetachObjectARB(ctx->lighting_program, ctx->lighting_frag);
+ glDetachObjectARB(ctx->lighting_program, ctx->lighting_vert);
+ glDeleteObjectARB(ctx->lighting_vert);
+ glDeleteObjectARB(ctx->lighting_frag);
+ glDeleteObjectARB(ctx->lighting_program);
+
+}
+
+/* OpenGL initial setup */
+RenderContext *render_setup() {
+
+ RenderContext *ctx;
+
+ ctx = malloc(sizeof(RenderContext));
+ if ( ctx == NULL ) return NULL;
+
+ glClearColor(0.0, 0.0, 0.0, 1.0);
+ glViewport(0, 0, 640, 480);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(50.0, 640.0/480.0, 0.1, 100.0); /* Depth buffer 10cm to 100m */
+
+ glEnable(GL_COLOR_MATERIAL);
+ glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
+
+ glFrontFace(GL_CCW);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_LIGHTING);
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ render_load_shaders(ctx);
+
+ ctx->num_textures = 0;
+
+ ctx->frames = 0;
+ ctx->t_fps = SDL_GetTicks();
+ ctx->fps = 0;
+
+ return ctx;
+
+}
+
+void render_shutdown(RenderContext *ctx) {
+ render_delete_shaders(ctx);
+ texture_free_all(ctx);
+}
+
+static int render_model_instance_draw(ModelInstance *instance, Uint32 t, RenderContext *ctx) {
+
+ int j;
+ Model *m;
+ GLfloat x, y, z;
+ GLfloat black[] = {0.0, 0.0, 0.0};
+
+ m = instance->model;
+ if ( m == NULL ) return 0; /* No model to draw */
+ x = instance->x;
+ y = instance->y;
+ z = instance->z;
+
+ for ( j=0; j<m->num_primitives; j++ ) {
+
+ Primitive *p;
+
+ p = m->primitives[j];
+
+ if ( p->attribs & ATTRIB_PULSE ) {
+ float s;
+ s = fabsf(cosf(t * 0.001));
+ GLfloat c[] = {s*p->col_r, s*p->col_g, s*p->col_b};
+ glMaterialfv(GL_FRONT, GL_EMISSION, c);
+ glColor3f(0.3, 0.3, 0.3);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, black);
+ } else if ( p->attribs & ATTRIB_COLOUR ) {
+ glMaterialfv(GL_FRONT, GL_EMISSION, black);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, black);
+ glColor3f(p->col_r, p->col_g, p->col_b);
+ } else {
+ glMaterialfv(GL_FRONT, GL_EMISSION, black);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, black);
+ glColor3f(1.0, 1.0, 1.0);
+ }
+
+ /* Location and orientation */
+ glPushMatrix();
+ glTranslatef(x, y, z);
+ glRotatef(rad2deg(instance->yaw), 0.0, 0.0, -1.0); /* Minus sign defines +yaw as "right" */
+
+ /* Texture */
+ if ( p->texture != NULL ) {
+ Texture *texture;
+ texture = texture_lookup(ctx, p->texture);
+ if ( texture != NULL ) {
+ glBindTexture(GL_TEXTURE_2D, texture->texname);
+ glEnable(GL_TEXTURE_2D);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ }
+ }
+
+ glVertexPointer(3, GL_FLOAT, 0, p->vertices);
+ glNormalPointer(GL_FLOAT, 0, p->normals);
+ glTexCoordPointer(2, GL_FLOAT, 0, p->texcoords);
+ glDrawArrays(p->type, 0, p->num_vertices);
+
+ glPopMatrix();
+
+ glDisable(GL_TEXTURE_2D);
+
+ }
+
+ return 0;
+
+}
+
+static void render_configure_light(int *ilightp, Light light, Room *room, Game *game) {
+
+ GLfloat x, y, z;
+ int ilight;
+
+ GLfloat pos[4];
+ GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
+ GLfloat specular[] = { 1.0, 1.0, 1.0, 1.0 };
+
+ ilight = *ilightp;
+
+ x = room->rx - game->cur_room_x;
+ y = room->ry - game->cur_room_y;
+ z = room->rz - game->cur_room_z;
+ glPushMatrix();
+ glTranslatef(10.0*x, 10.0*y, 10.0*z);
+
+ pos[0] = light.x;
+ pos[1] = light.y;
+ pos[2] = light.z;
+ pos[3] = 1.0;
+
+ if ( ilight < GL_MAX_LIGHTS ) {
+ glLightfv(GL_LIGHT0+ilight, GL_POSITION, pos);
+ glLightfv(GL_LIGHT0+ilight, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0+ilight, GL_SPECULAR, specular);
+ glLightf(GL_LIGHT0+ilight, GL_LINEAR_ATTENUATION, 0.01);
+ //glEnable(GL_LIGHT0+ilight);
+ ilight++;
+ }
+
+ glPopMatrix();
+
+ *ilightp = ilight;
+
+}
+
+static void render_setup_lighting(Game *game, Room *room_current) {
+
+ int i, ilight;
+ GLfloat ambient[4];
+
+ /* Start with a blackout */
+ for ( ilight=0; ilight<GL_MAX_LIGHTS; ilight++ ) {
+ glDisable(GL_LIGHT0+ilight);
+ }
+ ilight = 0;
+
+ /* Lights within this room */
+ for ( i=0; i<room_current->num_lights; i++ ) {
+ render_configure_light(&ilight, room_current->lights[i], room_current, game);
+ }
+
+ /* Lights in rooms connected to this one */
+ for ( i=0; i<room_current->num_connected; i++ ) {
+
+ Room *room;
+ int j;
+
+ room = game_find_room(game, room_current->connected[i].rx, room_current->connected[i].ry, room_current->connected[i].rz);
+ if ( room == NULL ) continue; /* Shouldn't happen... */
+
+ for ( j=0; j<room->num_lights; j++ ) {
+ render_configure_light(&ilight, room->lights[j], room, game);
+ }
+
+ }
+
+ //ambient[0] = 0.3; ambient[1] = 0.3; ambient[2] = 0.3; ambient[3] = 1.0;
+ ambient[0] = 1.0; ambient[1] = 1.0; ambient[2] = 1.0; ambient[3] = 1.0;
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
+
+}
+
+void render_draw(Game *game) {
+
+ int i;
+ Uint32 t;
+
+ t = SDL_GetTicks();
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ gluLookAt(game->lander->x-(1.5*sinf(game->lander->yaw)*cosf(game->view_angle)),
+ game->lander->y-(1.5*cosf(game->lander->yaw)*cosf(game->view_angle)), game->lander->z+(1.5*sinf(game->view_angle)),
+ game->lander->x, game->lander->y, game->lander->z,
+ sqrtf(2.0)*sinf(game->lander->yaw)*sinf(game->view_angle),
+ sqrtf(2.0)*cosf(game->lander->yaw)*sinf(game->view_angle), sqrtf(2.0)*cosf(game->view_angle));
+ //gluLookAt(game->lander->x-(1.5*sinf(game->lander->yaw)),
+ // game->lander->y-(1.5*cosf(game->lander->yaw)), 1.5+game->lander->z,
+ // game->lander->x, game->lander->y, game->lander->z,
+ // sqrt(2.0)*sinf(game->lander->yaw), sqrtf(2.0)*cosf(game->lander->yaw), sqrtf(2.0));
+ //gluLookAt(0.0, -250.0, -495.0+250.0,
+ // 0.0, 0.0, -495.0,
+ // 0.0, sqrtf(2.0), sqrtf(2.0));
+
+ /* Draw the objects */
+ //glUniform1iARB(glGetUniformLocationARB(game->render->lighting_program, "texture"), 0);
+ //glUseProgramObjectARB(game->render->lighting_program);
+ for ( i=0; i<game->num_rooms; i++ ) {
+
+ Room *room;
+ int j;
+
+ room = game->rooms[i];
+ if ( room == NULL ) return;
+
+ render_setup_lighting(game, room);
+
+ for ( j=0; j<room->num_objects; j++ ) {
+ GLfloat x, y, z;
+ if ( room->objects[j] == NULL ) continue;
+ x = room->rx - game->cur_room_x;
+ y = room->ry - game->cur_room_y;
+ z = room->rz - game->cur_room_z;
+ glPushMatrix();
+ glTranslatef(10.0*x, 10.0*y, 10.0*z);
+ render_model_instance_draw(room->objects[j], t, game->render);
+ glPopMatrix();
+ }
+
+ }
+ /* Finally, the lander */
+ render_model_instance_draw(game->lander, t, game->render);
+ //glUseProgramObjectARB(0);
+
+ SDL_GL_SwapBuffers();
+
+ game->render->frames++;
+ if ( t - game->render->t_fps > 1000 ) {
+ game->render->fps = (1000*game->render->frames) / (t - game->render->t_fps);
+ game->render->t_fps = t;
+ game->render->frames = 0;
+ }
+
+}
+
diff --git a/src/render.h b/src/render.h
new file mode 100644
index 0000000..96fe690
--- /dev/null
+++ b/src/render.h
@@ -0,0 +1,26 @@
+/*
+ * render.h
+ *
+ * Render the scene
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef RENDER_H
+#define RENDER_H
+
+#include "types.h"
+
+extern RenderContext *render_setup(void);
+extern void render_shutdown(RenderContext *ctx);
+extern void render_draw(Game *game);
+
+#endif /* RENDER_H */
+
diff --git a/src/texture.c b/src/texture.c
new file mode 100644
index 0000000..b2aba03
--- /dev/null
+++ b/src/texture.c
@@ -0,0 +1,180 @@
+/*
+ * texture.c
+ *
+ * Handle textures
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <png.h>
+#include <stdlib.h>
+#include <gl.h>
+#include <glu.h>
+
+#include "render.h"
+
+void texture_load(RenderContext *ctx, char *name) {
+
+ FILE *fh;
+ png_bytep header;
+ png_structp png_ptr;
+ png_infop info_ptr;
+ png_infop end_info;
+ unsigned int width;
+ unsigned int height;
+ unsigned int bit_depth;
+ unsigned int channels;
+ png_bytep *row_pointers;
+ unsigned int x;
+ unsigned int y;
+ char tmp[64];
+ uint8_t *texels;
+
+ /* Open file */
+ snprintf(tmp, 63, "%s/textures/%s.png", DATADIR, name);
+ fh = fopen(tmp, "rb");
+ if ( !fh ) {
+ fprintf(stderr, "Couldn't open texture file '%s'\n", tmp);
+ return ;
+ }
+
+ /* Check it's actually a PNG file */
+ header = malloc(8);
+ fread(header, 1, 8, fh);
+ if ( png_sig_cmp(header, 0, 8)) {
+ fprintf(stderr, "Texture file '%s' is not a PNG file.\n", tmp);
+ free(header);
+ fclose(fh);
+ return;
+ }
+ free(header);
+
+ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if ( !png_ptr ) {
+ fprintf(stderr, "Couldn't create PNG read structure.\n");
+ fclose(fh);
+ return ;
+ }
+
+ info_ptr = png_create_info_struct(png_ptr);
+ if ( !info_ptr ) {
+ png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
+ fprintf(stderr, "Couldn't create PNG info structure.\n");
+ fclose(fh);
+ return;
+ }
+
+ end_info = png_create_info_struct(png_ptr);
+ if ( !end_info ) {
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+ printf("Couldn't create PNG end info structure.\n");
+ fclose(fh);
+ return;
+ }
+
+ if ( setjmp(png_jmpbuf(png_ptr)) ) {
+ png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+ fclose(fh);
+ fprintf(stderr, "PNG read failed.\n");
+ return;
+ }
+
+ png_init_io(png_ptr, fh);
+ png_set_sig_bytes(png_ptr, 8);
+
+ /* Read! */
+ png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
+
+ width = png_get_image_width(png_ptr, info_ptr);
+ height = png_get_image_height(png_ptr, info_ptr);
+ bit_depth = png_get_bit_depth(png_ptr, info_ptr);
+ channels = png_get_channels(png_ptr, info_ptr);
+ if ( bit_depth != 8 ) {
+ fprintf(stderr, "Texture image '%s' isn't 8 bits per channel per pixel.\n", tmp);
+ png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+ fclose(fh);
+ return;
+ }
+ if ( channels != 4 ) {
+ fprintf(stderr, "Texture image '%s' doesn't have 4 channels.\n", tmp);
+ png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+ fclose(fh);
+ return;
+ }
+
+ /* Get image data */
+ row_pointers = png_get_rows(png_ptr, info_ptr);
+
+ texels = malloc(4*width*height);
+ for ( y=0; y<height; y++ ) {
+ for ( x=0; x<width; x++ ) {
+
+ unsigned int r, g, b, a;
+
+ r = row_pointers[y][(channels*x)+0];
+ g = row_pointers[y][(channels*x)+1];
+ b = row_pointers[y][(channels*x)+2];
+ a = row_pointers[y][(channels*x)+3];
+
+ texels[4*(x + width*(height-1-y)) + 0] = r;
+ texels[4*(x + width*(height-1-y)) + 1] = g;
+ texels[4*(x + width*(height-1-y)) + 2] = b;
+ texels[4*(x + width*(height-1-y)) + 3] = a;
+
+ }
+ }
+
+ glGenTextures(1, &(ctx->textures[ctx->num_textures].texname));
+ glBindTexture(GL_TEXTURE_2D, ctx->textures[ctx->num_textures].texname);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texels);
+ gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA8, width, height, GL_RGBA, GL_UNSIGNED_BYTE, texels);
+ free(texels);
+ ctx->textures[ctx->num_textures].name = name;
+ ctx->num_textures++;
+
+ png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+ fclose(fh);
+
+}
+
+Texture *texture_lookup(RenderContext *ctx, const char *name) {
+
+ int i, found;
+
+ found = 0;
+ for ( i=0; i<ctx->num_textures; i++ ) {
+ if ( strcmp(ctx->textures[i].name, name) == 0 ) {
+ found = 1;
+ break;
+ }
+ }
+
+ if ( found == 0 ) {
+ return NULL;
+ }
+
+ return &(ctx->textures[i]);
+
+}
+
+void texture_free_all(RenderContext *ctx) {
+
+ int i;
+
+ for ( i=0; i<ctx->num_textures; i++ ) {
+ glDeleteTextures(1, &(ctx->textures[ctx->num_textures].texname));
+ }
+
+}
+
diff --git a/src/texture.h b/src/texture.h
new file mode 100644
index 0000000..df4091e
--- /dev/null
+++ b/src/texture.h
@@ -0,0 +1,26 @@
+/*
+ * texture.h
+ *
+ * Handle textures
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef TEXTURE_H
+#define TEXTURE_H
+
+#include "types.h"
+
+extern void texture_load(RenderContext *ctx, const char *name);
+extern Texture *texture_lookup(RenderContext *ctx, const char *name);
+extern void texture_free_all(RenderContext *ctx);
+
+#endif /* TEXTURE_H */
+
diff --git a/src/types.h b/src/types.h
new file mode 100644
index 0000000..78864a9
--- /dev/null
+++ b/src/types.h
@@ -0,0 +1,174 @@
+/*
+ * types.h
+ *
+ * All the data types - avoid circular reference silliness
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef TYPES_H
+#define TYPES_H
+
+#include <gl.h>
+#include <SDL.h>
+
+/* Maximum number of individual textures */
+#define MAX_TEXTURES 128
+
+/* Maximum number of rooms which can be "seen" at once */
+#define MAX_ROOMS 64
+
+/* Maximum number of lights per room */
+#define MAX_LIGHTS 4
+
+typedef enum {
+ ATTRIB_NONE = 0,
+ ATTRIB_COLOUR = 1<<0, /* Colour specified? */
+ ATTRIB_PULSE = 1<<1, /* Pulsating colour */
+} PrimitiveAttrib;
+
+typedef struct {
+
+ GLenum type;
+ int num_vertices;
+ GLfloat *vertices;
+ GLfloat *normals;
+ GLfloat *texcoords;
+
+ PrimitiveAttrib attribs;
+ GLfloat col_r;
+ GLfloat col_g;
+ GLfloat col_b;
+ char *texture;
+
+} Primitive;
+
+typedef struct {
+
+ char *name; /* Identifier */
+
+ int num_primitives;
+ Primitive **primitives; /* Geometry */
+
+ PrimitiveAttrib attrib_total;
+
+} Model;
+
+typedef struct {
+ int num_models;
+ Model **models;
+} ModelContext;
+
+typedef enum {
+ OBJ_NONE = 0,
+ OBJ_GRAVITY = 1<<0, /* Object is subject to gravity */
+} ObjectAttrib;
+
+typedef struct {
+
+ Model *model;
+
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+
+ ObjectAttrib attribs;
+ GLfloat vx;
+ GLfloat vy;
+ GLfloat vz;
+
+ float yaw;
+ float yawspeed;
+
+} ModelInstance;
+
+typedef struct {
+ char *name;
+ GLuint *data;
+ GLuint texname;
+} Texture;
+
+typedef struct {
+
+ /* Lighting shaders */
+ GLhandleARB lighting_vert;
+ GLhandleARB lighting_frag;
+ GLhandleARB lighting_program;
+
+ /* Textures */
+ Texture textures[MAX_TEXTURES];
+ unsigned int num_textures;
+
+ int frames;
+ Uint32 t_fps;
+ int fps;
+
+} RenderContext;
+
+typedef struct {
+ int rx;
+ int ry;
+ int rz;
+} Connection;
+
+typedef struct {
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+} Light;
+
+typedef struct {
+
+ ModelInstance **objects;
+ int num_objects;
+
+ int rx;
+ int ry;
+ int rz;
+
+ int needed_this_time;
+ Connection connected[MAX_ROOMS];
+ int num_connected;
+
+ Light lights[MAX_LIGHTS];
+ int num_lights;
+
+} Room;
+
+typedef struct {
+
+ unsigned int thrusting;
+ unsigned int turn_left;
+ unsigned int turn_right;
+ unsigned int forward;
+ unsigned int reverse;
+
+ Uint32 tlast; /* Time at which the last physics step was performed */
+
+ ModelInstance *lander;
+
+ ModelContext *models;
+ RenderContext *render;
+
+ int cur_room_x;
+ int cur_room_y;
+ int cur_room_z;
+
+ Room *rooms[MAX_ROOMS];
+ int num_rooms;
+
+ float view_angle;
+ int paused;
+ int pause_rel;
+
+} Game;
+
+#endif /* TYPES_H */
+
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..fad8edb
--- /dev/null
+++ b/src/utils.c
@@ -0,0 +1,30 @@
+/*
+ * utils.c
+ *
+ * Utility stuff
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+void chomp(char *a) {
+
+ unsigned int i;
+
+ for ( i=0; i<strlen(a); i++ ) {
+ if ( a[i] == '\n' ) {
+ a[i] = '\0';
+ return;
+ }
+ }
+
+}
+
diff --git a/src/utils.h b/src/utils.h
new file mode 100644
index 0000000..cfbf6ad
--- /dev/null
+++ b/src/utils.h
@@ -0,0 +1,27 @@
+/*
+ * utils.h
+ *
+ * Utility stuff
+ *
+ * (c) 2008 Thomas White <taw27@cam.ac.uk>
+ *
+ * thrust3d - a silly game
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <math.h>
+
+#define rad2deg(a) ((a)*180/M_PI)
+#define deg2rad(a) ((a)*M_PI/180)
+
+extern void chomp(char *a);
+
+#endif /* UTILS_H */
+