This commit is contained in:
Alexander Deynichenko
2013-02-25 07:23:44 +04:00
parent 35ff18a6a1
commit 03b62f3315
809 changed files with 211135 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
SIMON was written by Steve Baker.
AstroPong was written by Oliver Baker.
+340
View File
@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
+13
View File
@@ -0,0 +1,13 @@
all:
(cd src ; make)
install:
(cd src ; make install)
uninstall:
(cd src ; make uninstall)
clean:
(cd src ; make clean)
+60
View File
@@ -0,0 +1,60 @@
WELCOME TO S.I.M.O.N
====================
Which stands for:
Simple
Interface for
Making
Oliver's programs
Nice.
This is a simple set of functions that hide much of the nastiness
of 3D programming to make it possible for someone with only the
very minimum of programming experience to write simple 3D applications.
INSTALLATION
============
Right now, you build SIMON by running 'make' and install it by
running 'make install' as root. You must already have PLIB installed.
Simon installs into /usr/local/simon/libsimon.a /usr/local/simon/simon.h
and places an executable into /usr/local/bin/simon
RUNNING SIMON
=============
There are two ways to write SIMON programs:
1) Write your code in C++ and link it to libsimon
(the LIBRARY version of SIMON).
2) Write your code in PSL (The PLIB Scripting Language)
and use the 'simon' program to run it.
Documentation for both methods are in the 'doc' directory.
DEMO'S
======
AstroPong is my son's first ever game (his first ever program actually).
It was originally written in C++ using libsimon - but has subsequently
been converted into PSL for use as a demonstration program.
Once you've done a 'make install', you can change directory down into
the 'simon' directory and run:
simon astropong.psl
...move your paddle using the joystick - don't let the herring
escape from the ice cube!
+249
View File
@@ -0,0 +1,249 @@
/*
AstroPong - A 3D Pong Game
Copyright (C) 2002 Oliver Baker
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: astropong.psl 1699 2002-09-22 15:22:21Z sjbaker $
*/
#define ARENA_SIZE 8.0 /* meters */
#define ARENA_LENGTH 10.0 /* meters */
#define BALL_SIZE 2.5 /* meters */
#define BOUNCE (ARENA_SIZE/2.0 - BALL_SIZE/2.0)
#define BOUNCEY (ARENA_LENGTH/2.0 - BALL_SIZE/2.0)
#define BAT_SIZE (1.0 + BALL_SIZE/2.0) /* From the center to the sides */
int arena ;
int shadow ;
int difficulty ;
int scoreBoardR ;
int scoreBoardB ;
int ball ;
int bPaddle ;
int rPaddle ;
int camera ;
int scoreR ;
int scoreB ;
float Blue_batspeed = .34;
float scoreSpinR ;
float scoreSpinB ;
float ballSpinH ;
float ballSpinSH ;
float ballSpinP ;
float ballSpinSP ;
float ballSpinR ;
float ballSpinSR ;
float ballX ;
float ballY ;
float ballZ ;
float ballSX ;
float ballSY ;
float ballSZ ;
float bpaddleX ;
float bpaddleZ ;
float rpaddleX ;
float rpaddleZ ;
float userX ;
float userZ ;
int frameno = 0 ;
int main()
{
camera = 0 ;
arena = siLoad ( "arena2.ac") ;
ball = siLoad ( "ball3.ac") ;
bPaddle = siLoad ( "bluepaddle2.ac");
rPaddle = siLoad ( "redpaddle2.ac") ;
scoreBoardR = siLoad ( "Scoreboard.ac") ;
scoreBoardB = siLoad ( "Scoreboard.ac") ;
shadow = siLoad ( "shadow2.ac") ;
scoreSpinR = 0 ;
scoreSpinB = 0 ;
ballSX = 0.166 ;
ballSY = 0.155 ;
ballSZ = 0.016 ;
ballSpinSH = 4 ;
ballSpinSP = 4 ;
ballSpinSR = 4 ;
difficulty = 1 ;
if ( difficulty == 1 ) { Blue_batspeed = .275 ; }
else { Blue_batspeed = .34 ; }
while ( 1 )
{
frameno = frameno + 1 ;
/* Read the joystick */
userX = siJoystickLR();
userZ = siJoystickUD();
/* Move the ball */
ballX += ballSX ;
ballY += ballSY ;
ballZ += ballSZ ;
ballSpinH += ballSpinSH ;
ballSpinP += ballSpinSP ;
ballSpinR += ballSpinSR ;
/* Bounce off the sides? */
if ( ballX > BOUNCE || ballX < -BOUNCE )
{
ballSX = -ballSX ;
}
/* Bounce off the top and bottom? */
if ( ballZ > BOUNCE || ballZ < -BOUNCE )
{
ballSZ = -ballSZ ;
}
/* What happens at the ends? */
if ( ballY > BOUNCEY ) /* Passed the blue paddle? */
{
/* Is the blue bat there? */
if (ballX > bpaddleX - BAT_SIZE && ballX < bpaddleX + BAT_SIZE &&
ballZ > bpaddleZ - BAT_SIZE && ballZ < bpaddleZ + BAT_SIZE )
{
float hitX = ballX - bpaddleX ;
float hitZ = ballZ - bpaddleZ ;
if ( ballSX > 0 )
ballSX = fabs ( hitX / 2.0 ) ;
else
ballSX = -fabs ( hitX / 2.0 ) ;
if ( ballSZ > 0 )
ballSZ = fabs ( hitZ / 2.0 ) ;
else
ballSZ = -fabs ( hitZ / 2.0 ) ;
ballSY = -ballSY ;
}
else
{
scoreR++ ;
print ("The score is Red:", scoreR, " Blue:", scoreB, "\n" ) ;
ballSX = 0.1 ;
ballSY = 0.1 ;
ballSZ = 0.1;
ballSY = -ballSY ;
ballX = 0.0 ;
ballY = 0.0 ;
ballZ = 0.0;
for ( int i = 0 ; i < 60 ; i++ ) pause ;
}
}
if ( ballY < -BOUNCEY ) /* Passed the red paddle? */
{
/* Was the red bat there? */
if (ballX > rpaddleX - BAT_SIZE && ballX < rpaddleX + BAT_SIZE &&
ballZ > rpaddleZ - BAT_SIZE && ballZ < rpaddleZ + BAT_SIZE )
{
float hitX = ballX - rpaddleX ;
float hitZ = ballZ - rpaddleZ ;
if ( ballSX > 0 )
ballSX = fabs ( hitX / 2.0 ) ;
else
ballSX = -fabs ( hitX / 2.0 ) ;
if ( ballSZ > 0 )
ballSZ = fabs ( hitZ / 2.0 ) ;
else
ballSZ = -fabs ( hitZ / 2.0 ) ;
ballSY = -ballSY ;
}
else
{
scoreB++ ;
print ("The score is Red:", scoreR, " Blue:", scoreB, "\n" ) ;
ballSX = .1 ;
ballSY = .1 ;
ballSZ = .1;
ballSY = -ballSY ;
ballX = 0.0 ;
ballY = 0.0 ;
ballZ = 0.0;
for ( int i = 0 ; i < 60 ; i++ ) pause ;
}
}
/* Update the scoreboard */
scoreSpinR = scoreR * -36.0 ;
scoreSpinB = scoreB * -36.0 ;
/* How should the computer move the paddle? */
if ( ballZ > bpaddleZ ) { bpaddleZ += Blue_batspeed ; }
else { bpaddleZ -= Blue_batspeed ; }
if ( ballX > bpaddleX ) { bpaddleX += Blue_batspeed ; }
else { bpaddleX -= Blue_batspeed ; }
/* How did the player move the paddle? */
rpaddleX += userX * -.5;
rpaddleZ += userZ * .5;
/* Did the paddle move off the edge of the screen? */
if ( rpaddleX > BOUNCE ) rpaddleX = BOUNCE ;
if ( rpaddleX < -BOUNCE ) rpaddleX = -BOUNCE ;
if ( rpaddleZ > BOUNCE ) rpaddleZ = BOUNCE ;
if ( rpaddleZ < -BOUNCE ) rpaddleZ = -BOUNCE ;
/* Tell SIMON where to position the paddle, ball and camera */
/* MODEL X, Y, Z, H, P, R */
siPosition ( scoreBoardR, 1, 0, 0, 0, scoreSpinR, 0 ) ;
siPosition ( scoreBoardB, -1, 0, 0, 0, scoreSpinB, 0 ) ;
siPosition ( bPaddle , bpaddleX, 5, bpaddleZ, 0, 0 , 0 ) ;
siPosition ( rPaddle , rpaddleX, -5, rpaddleZ, 0, 0 , 0 ) ;
siPosition ( ball , ballX, ballY, ballZ,
ballSpinH,ballSpinP,ballSpinR);
siPosition ( arena , 0, 0, 0, 0, 0 , 0 ) ;
siPosition ( shadow , ballX, ballY, -4, 0, 0 , 0 ) ;
siPosition ( camera , 0, -10, 0, 0, 0 , 0 ) ;
pause ;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
+272
View File
@@ -0,0 +1,272 @@
AC3Db
MATERIAL "ac3dmat8" rgb 0.627 0.753 0.878 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.502 0.502 0.502 shi 10 trans 0.655
OBJECT world
kids 1
OBJECT poly
numvert 96
4.975 -4.975 -4.975
4.975 -4.975 4.975
4 -5 5
4 -5 -5
4.975 4.975 -4.975
4 5 -5
4 5 5
4.975 4.975 4.975
4 5 -5
4 -5 -5
4 -5 5
4 5 5
4.975 4.975 4.975
4.975 -4.975 4.975
4.975 -4.975 -4.975
4.975 4.975 -4.975
4.975 4.975 -4.975
4.975 -4.975 -4.975
4 -5 -5
4 5 -5
4 5 5
4 -5 5
4.975 -4.975 4.975
4.975 4.975 4.975
-4 -5 -5
-4 -5 5
-4.975 -4.975 4.975
-4.975 -4.975 -4.975
-4 5 -5
-4.975 4.975 -4.975
-4.975 4.975 4.975
-4 5 5
-4.975 4.975 -4.975
-4.975 -4.975 -4.975
-4.975 -4.975 4.975
-4.975 4.975 4.975
-4 5 5
-4 -5 5
-4 -5 -5
-4 5 -5
-4 5 -5
-4 -5 -5
-4.975 -4.975 -4.975
-4.975 4.975 -4.975
-4.975 4.975 4.975
-4.975 -4.975 4.975
-4 -5 5
-4 5 5
4.95 -3.96 -4.95
4.95 -3.96 4.95
4.975 -4.975 4.975
4.975 -4.975 -4.975
-4.95 -3.96 -4.95
-4.975 -4.975 -4.975
-4.975 -4.975 4.975
-4.95 -3.96 4.95
-4.975 -4.975 -4.975
4.975 -4.975 -4.975
4.975 -4.975 4.975
-4.975 -4.975 4.975
-4.95 -3.96 4.95
4.95 -3.96 4.95
4.95 -3.96 -4.95
-4.95 -3.96 -4.95
-4.95 -3.96 -4.95
4.95 -3.96 -4.95
4.975 -4.975 -4.975
-4.975 -4.975 -4.975
-4.975 -4.975 4.975
4.975 -4.975 4.975
4.95 -3.96 4.95
-4.95 -3.96 4.95
4.975 4.975 -4.975
4.975 4.975 4.975
4.95 3.96 4.95
4.95 3.96 -4.95
-4.975 4.975 -4.975
-4.95 3.96 -4.95
-4.95 3.96 4.95
-4.975 4.975 4.975
-4.95 3.96 -4.95
4.95 3.96 -4.95
4.95 3.96 4.95
-4.95 3.96 4.95
-4.975 4.975 4.975
4.975 4.975 4.975
4.975 4.975 -4.975
-4.975 4.975 -4.975
-4.975 4.975 -4.975
4.975 4.975 -4.975
4.95 3.96 -4.95
-4.95 3.96 -4.95
-4.95 3.96 4.95
4.95 3.96 4.95
4.975 4.975 4.975
-4.975 4.975 4.975
numsurf 24
SURF 0x30
mat 0
refs 4
0 0 0
1 1 0
2 1 1
3 0 1
SURF 0x30
mat 0
refs 4
4 0 0
5 1 0
6 1 1
7 0 1
SURF 0x30
mat 0
refs 4
8 0 0
9 1 0
10 1 1
11 0 1
SURF 0x30
mat 0
refs 4
12 0 0
13 1 0
14 1 1
15 0 1
SURF 0x30
mat 0
refs 4
16 0 0
17 1 0
18 1 1
19 0 1
SURF 0x30
mat 0
refs 4
20 0 0
21 1 0
22 1 1
23 0 1
SURF 0x30
mat 0
refs 4
24 0 0
25 1 0
26 1 1
27 0 1
SURF 0x30
mat 0
refs 4
28 0 0
29 1 0
30 1 1
31 0 1
SURF 0x30
mat 0
refs 4
32 0 0
33 1 0
34 1 1
35 0 1
SURF 0x30
mat 0
refs 4
36 0 0
37 1 0
38 1 1
39 0 1
SURF 0x30
mat 0
refs 4
40 0 0
41 1 0
42 1 1
43 0 1
SURF 0x30
mat 0
refs 4
44 0 0
45 1 0
46 1 1
47 0 1
SURF 0x30
mat 0
refs 4
48 0 0
49 1 0
50 1 1
51 0 1
SURF 0x30
mat 0
refs 4
52 0 0
53 1 0
54 1 1
55 0 1
SURF 0x30
mat 0
refs 4
56 0 0
57 1 0
58 1 1
59 0 1
SURF 0x30
mat 0
refs 4
60 0 0
61 1 0
62 1 1
63 0 1
SURF 0x30
mat 0
refs 4
64 0 0
65 1 0
66 1 1
67 0 1
SURF 0x30
mat 0
refs 4
68 0 0
69 1 0
70 1 1
71 0 1
SURF 0x30
mat 0
refs 4
72 0 0
73 1 0
74 1 1
75 0 1
SURF 0x30
mat 0
refs 4
76 0 0
77 1 0
78 1 1
79 0 1
SURF 0x30
mat 0
refs 4
80 0 0
81 1 0
82 1 1
83 0 1
SURF 0x30
mat 0
refs 4
84 0 0
85 1 0
86 1 1
87 0 1
SURF 0x30
mat 0
refs 4
88 0 0
89 1 0
90 1 1
91 0 1
SURF 0x30
mat 0
refs 4
92 0 0
93 1 0
94 1 1
95 0 1
kids 0
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
+577
View File
@@ -0,0 +1,577 @@
AC3Db
MATERIAL "ac3dmat0" rgb 0 0 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0
OBJECT world
kids 1
OBJECT poly
name "disk"
numvert 82
0.5 0 0
0.498496 0 0.0387462
0.493995 0 0.0772594
0.486522 0 0.115308
0.476124 0 0.152663
0.462862 0 0.1891
0.446816 0 0.2244
0.428083 0 0.25835
0.406776 0 0.290746
0.383022 0 0.321394
0.356965 0 0.350109
0.328761 0 0.376718
0.298579 0 0.401062
0.266602 0 0.422993
0.233022 0 0.442381
0.19804 0 0.459108
0.161867 0 0.473074
0.124721 0 0.484195
0.0868241 0 0.492404
0.0484054 0 0.497651
0.00969563 0 0.499906
-0.0290725 0 0.499154
-0.0676657 0 0.4954
-0.105852 0 0.488667
-0.143402 0 0.478995
-0.180089 0 0.466442
-0.215693 0 0.451084
-0.25 0 0.433013
-0.282803 0 0.412337
-0.313906 0 0.389182
-0.343121 0 0.363687
-0.370272 0 0.336004
-0.395196 0 0.3063
-0.417744 0 0.274754
-0.437779 0 0.241556
-0.455182 0 0.206905
-0.469846 0 0.17101
-0.481685 0 0.134086
-0.490628 0 0.0963561
-0.496619 0 0.0580464
-0.499624 0 0.0193876
-0.499624 0 -0.0193878
-0.496619 0 -0.0580465
-0.490628 0 -0.0963562
-0.481685 0 -0.134086
-0.469846 0 -0.17101
-0.455181 0 -0.206905
-0.437779 0 -0.241556
-0.417744 0 -0.274755
-0.395196 0 -0.3063
-0.370272 0 -0.336004
-0.343121 0 -0.363687
-0.313906 0 -0.389183
-0.282803 0 -0.412338
-0.25 0 -0.433013
-0.215693 0 -0.451084
-0.180089 0 -0.466442
-0.143402 0 -0.478995
-0.105852 0 -0.488667
-0.0676655 0 -0.4954
-0.0290723 0 -0.499154
0.00969578 0 -0.499906
0.0484056 0 -0.497651
0.0868242 0 -0.492404
0.124721 0 -0.484195
0.161867 0 -0.473074
0.19804 0 -0.459108
0.233022 0 -0.442381
0.266602 0 -0.422993
0.298579 0 -0.401062
0.328761 0 -0.376718
0.356965 0 -0.350109
0.383022 0 -0.321394
0.406776 0 -0.290746
0.428084 0 -0.25835
0.446816 0 -0.224399
0.462862 0 -0.1891
0.476124 0 -0.152663
0.486522 0 -0.115308
0.493995 0 -0.0772592
0.498496 0 -0.0387461
0 0 0
numsurf 81
SURF 0x20
mat 0
refs 3
0 1 0.5
1 0.998496 0.461246
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
1 0.998496 0.461246
2 0.993993 0.422726
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
2 0.993993 0.422726
3 0.986517 0.38467
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
3 0.986517 0.38467
4 0.976115 0.347308
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
4 0.976115 0.347308
5 0.962848 0.310865
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
5 0.962848 0.310865
6 0.946796 0.275558
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
6 0.946796 0.275558
7 0.928056 0.241602
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
7 0.928056 0.241602
8 0.906741 0.209199
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
8 0.906741 0.209199
9 0.882978 0.178546
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
9 0.882978 0.178546
10 0.856911 0.149825
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
10 0.856911 0.149825
11 0.828696 0.123211
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
11 0.828696 0.123211
12 0.798503 0.0988629
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
12 0.798503 0.0988629
13 0.766514 0.0769272
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
13 0.766514 0.0769272
14 0.732921 0.0575359
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
14 0.732921 0.0575359
15 0.697926 0.0408056
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
15 0.697926 0.0408056
16 0.66174 0.0268369
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
16 0.66174 0.0268369
17 0.624579 0.0157139
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
17 0.624579 0.0157139
18 0.586669 0.00750349
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
18 0.586669 0.00750349
19 0.548236 0.002255
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
19 0.548236 0.002255
20 0.509511 0
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
20 0.509511 0
21 0.470729 0.000752024
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
21 0.470729 0.000752024
22 0.432121 0.00450663
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
22 0.432121 0.00450663
23 0.39392 0.0112412
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
23 0.39392 0.0112412
24 0.356356 0.0209152
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
24 0.356356 0.0209152
25 0.319655 0.0334704
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
25 0.319655 0.0334704
26 0.284038 0.0488315
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
26 0.284038 0.0488315
27 0.249718 0.0669059
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
27 0.249718 0.0669059
28 0.216902 0.087585
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
28 0.216902 0.087585
29 0.185788 0.110744
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
29 0.185788 0.110744
30 0.156562 0.136245
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
30 0.156562 0.136245
31 0.129401 0.163933
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
31 0.129401 0.163933
32 0.104467 0.193642
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
32 0.104467 0.193642
33 0.0819108 0.225194
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
33 0.0819108 0.225194
34 0.0618681 0.258398
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
34 0.0618681 0.258398
35 0.0444592 0.293056
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
35 0.0444592 0.293056
36 0.0297888 0.328958
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
36 0.0297888 0.328958
37 0.0179453 0.365889
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
37 0.0179453 0.365889
38 0.00899969 0.403626
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
38 0.00899969 0.403626
39 0.00300592 0.441943
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
39 0.00300592 0.441943
40 0 0.480609
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
40 0 0.480609
41 0 0.519391
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
41 0 0.519391
42 0.00300595 0.558057
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
42 0.00300595 0.558057
43 0.00899972 0.596374
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
43 0.00899972 0.596374
44 0.0179453 0.634112
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
44 0.0179453 0.634112
45 0.0297889 0.671042
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
45 0.0297889 0.671042
46 0.0444592 0.706944
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
46 0.0444592 0.706944
47 0.0618682 0.741602
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
47 0.0618682 0.741602
48 0.0819109 0.774806
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
48 0.0819109 0.774806
49 0.104467 0.806358
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
49 0.104467 0.806358
50 0.129401 0.836067
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
50 0.129401 0.836067
51 0.156562 0.863755
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
51 0.156562 0.863755
52 0.185788 0.889256
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
52 0.185788 0.889256
53 0.216902 0.912415
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
53 0.216902 0.912415
54 0.249718 0.933094
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
54 0.249718 0.933094
55 0.284038 0.951169
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
55 0.284038 0.951169
56 0.319655 0.96653
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
56 0.319655 0.96653
57 0.356356 0.979085
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
57 0.356356 0.979085
58 0.39392 0.988759
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
58 0.39392 0.988759
59 0.432121 0.995493
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
59 0.432121 0.995493
60 0.470729 0.999248
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
60 0.470729 0.999248
61 0.509511 1
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
61 0.509511 1
62 0.548236 0.997745
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
62 0.548236 0.997745
63 0.586669 0.992496
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
63 0.586669 0.992496
64 0.624579 0.984286
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
64 0.624579 0.984286
65 0.66174 0.973163
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
65 0.66174 0.973163
66 0.697926 0.959194
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
66 0.697926 0.959194
67 0.732921 0.942464
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
67 0.732921 0.942464
68 0.766515 0.923073
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
68 0.766515 0.923073
69 0.798504 0.901137
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
69 0.798504 0.901137
70 0.828696 0.876789
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
70 0.828696 0.876789
71 0.856911 0.850174
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
71 0.856911 0.850174
72 0.882978 0.821454
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
72 0.882978 0.821454
73 0.906741 0.790801
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
73 0.906741 0.790801
74 0.928056 0.758398
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
74 0.928056 0.758398
75 0.946796 0.724442
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
75 0.946796 0.724442
76 0.962848 0.689135
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
76 0.962848 0.689135
77 0.976115 0.652692
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
77 0.976115 0.652692
78 0.986517 0.61533
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
78 0.986517 0.61533
79 0.993993 0.577274
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
79 0.993993 0.577274
80 0.998496 0.538753
81 0.499812 0.5
SURF 0x20
mat 0
refs 3
80 0.998496 0.538753
0 1 0.5
81 0.499812 0.5
kids 0
+256
View File
@@ -0,0 +1,256 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>WELCOME TO S.I.M.O.N</TITLE>
</HEAD>
<BODY>
<H1>WELCOME TO S.I.M.O.N</H1>
<center>by Steve Baker</center>
SIMON stands for:
<pre>
Simple
Interface for
Making
Oliver's programs
Nice.
</pre>
This is a simple set of functions that hide much of the nastiness
of 3D programming to make it possible for someone with only the
very minimum of programming experience to write simple 3D applications.
<p>
If you want something more complicated or with better features then
don't complain about SIMON - just use raw PLIB (upon which SIMON is
based).
<H1>HOW TO WRITE YOUR PROGRAM.</H1>
You have to write TWO C (or C++) functions:
<pre>
int main ()
</pre>
...and...
<pre>
void siUpdate ()
</pre>
The 'main' function has to load whatever 3D models the program needs
and then call a function called 'siRun()'.
<p>
siRun does things like opening the 3D window, clearing the screen and
drawing all of the models. When it's time to move the models around,
it calls your function 'siUpdate'.
<p>
All SIMON programs have to start with the line:
<pre>
#include &lt;simon.h&gt;
</pre>
...this brings in all the information the compiler needs in order for you to
write a SIMON program. Think of it like '#include &lt;stdio.h&gt;' but for
programs that are just doing 3D rendering.
<p>
Then, you have to declare an integer variable for everything in the scene
that your program needs - which includes at least the scenery and the camera.
<p>
For example:
<pre>
int camera ;
int tux ;
int scenery ;
</pre>
Next, you have your 'main' program - which loads up the models and then
calls the 'siRun()' function and then exits.
<pre>
int main ()
{
scenery = siLoad ( "scenery.ac" ) ;
tux = siLoad ( "tuxedo.ac" ) ;
camera = 0 ;
siRun () ;
return 0 ;
}
</pre>
The 'siLoad' function loads a 3D model and returns a number for
that model that you can save into a variable. That number can be
used to move the model around later on. The final part of this
'loading' stage is to set the number for the 'camera'. In SIMON,
the camera is always model number zero and you can't 'siLoad' a
model for it or it won't work.
<p>
Then, you call 'siRun()' - which runs the entire update process. If
'siRun' ever returns, you can just exit the program.
<p>
Now we have our scene all set up and ready to go - so the program
will call your 'siUpdate' function to move the models (and the
camera) around - and then draw the scene.
<pre>
int frameno = 0 ;
void siUpdate ()
{
frameno = frameno + 1 ;
siPosition ( tux , 0, 0, 0, frameno, 0, 0 ) ;
siPosition ( camera, 0, -5, 1, 0, 0, 0 ) ;
}
</pre>
Here we defined a simple variable called 'frameno' which is increased
by one every time the 'siUpdate' function is called to give the program
an idea of how much time has gone by.
<p>
Finally, we set the position of the camera and tux by calling
'siPosition' for each of them.
<p>
'siPosition' is a function that needs SEVEN things to be passed to it.
<ol>
<li>The first is the variable that contains the number of the object you
want to position.
<li>The second is the X coordinate that you want that object to have
(in Meters).
<li>The third is the Y coordinate.
<li>The fourth is the Z coordinate (the height).
<li>The fifth is the 'heading' - which is the direction that the object
is pointing. If you model your objects with their noses pointing
North in the modeller then this number will be the angle in degrees
measured in an anticlockwise direction from due North.
<li>The sixth is the 'pitch' - which is the amount that the object is
leaning backwards (in degrees).
<li>The seventh (and last) is the 'roll' - which is the amount that the
object is leaning sideways (also in degrees).
</ol>
That's a lot of information - but it's what you need to tell the
object for it to know where to appear in the scene.
<p>
In our example program, we first had:
<pre>
siPosition ( tux, 0, 0, 0, frameno, 0, 0 ) ;
</pre>
...which puts Tux at X=0, Y=0, Z=0 (which is at the origin of the scene)
and sets his 'heading' equal to this 'frameno' variable. Thus, as time
goes on, and we keep adding one to 'frameno', Tux's heading number will
gradually increase from zero upwards. This should cause him to rotate
in place. Since pitch and roll are both zero, he'll be standing upright.
<p>
The slPosition command for the Camera:
<pre>
siPosition ( camera, 0, -5, 1, 0, 0, 0 ) ;
</pre>
...puts the camera at X=0, Y=-5, Z=1 - which is back 5 meters from where
Tux is - and one meter up into the air. This should give us a nice view
of him as he spins.
<H1>READING THE JOYSTICK.</H1>
These functions let you read the Left/Right and Up/Down axes of the
joystick:
<pre>
leftright = siJoystickLR () ;
updown = siJoystickUD () ;
</pre>
The numbers that this will put into the variables 'leftright' and
'updown' range from -1.0 to +1.0. Leftwards and Upwards movements
generate 1, Rightwards and Downwards movements generate -1, when the
stick is in the middle you get zeroes.
<p>
To read the buttons, you can use these functions:
<pre>
buttonA = siJoystickA () ;
buttonB = siJoystickB () ;
buttonC = siJoystickC () ;
buttonD = siJoystickD () ;
buttonL = siJoystickL () ;
buttonR = siJoystickR () ;
</pre>
...the variables should be 'int' varaibles and will be set to 1 if the
button is pressed or 0 if it's not.
<H1>OTHER MOVEMENT COMMANDS.</H1>
Other commands let you set the Velocity for objects:
<pre>
siVelocity ( object, x, y, z, h, p, r ) ;
</pre>
...and set a speed and a direction:
<pre>
siSpeedAndDirection ( object, speed, heading, pitch ) ;
</pre>
...you can also get the current position for the object:
<pre>
x = siGetPositionX ( object ) ;
y = siGetPositionY ( object ) ;
z = siGetPositionZ ( object ) ;
h = siGetPositionH ( object ) ;
p = siGetPositionP ( object ) ;
r = siGetPositionR ( object ) ;
</pre>
<H1>THE MAKEFILE.</H1>
Once you start to have things like SIMON being used with your program,
it can be quite a complicated process to compile your program. It's a
lot of typing and you'll make lots of mistakes.
<p>
For that reason, Linux uses a command called 'make' to compile complicated
programs according to some rules that you tell it in a special file that's
called 'Makefile'. Once you have a 'Makefile' set up for your program,
you only ever need to type 'make' in order to compile your program -
no matter how complicated it gets to be.
<p>
A good 'Makefile' for a SIMON program would be:
<pre>
#
# List the names of the programs we want to build here...
#
TARGETS = test1
#======================== DON'T CHANGE THIS PART =============================
#
SIMONDIR = /usr/local/simon
SIMON = -I${SIMONDIR} -L${SIMONDIR}
LIBS = -lsimon -lplibssg -lplibsg -lplibul -lglut -lGLU -lGL -L/usr/X11/lib -lX11 -lm
all: ${TARGETS}
#=============================================================================
#
# Copy this for every program you want to write - changing 'test1'
# to whatever your program is called.
#
test1 : test1.cxx ; g++ ${SIMON} -o test1 test1.cxx ${LIBS}
</pre>
</BODY>
</HTML>
+31
View File
@@ -0,0 +1,31 @@
CXX=g++
SIMON = libsimon.a simon
LIBS = -lplibpsl -lplibssg -lplibsg -lplibjs -lplibul -lglut -lGLU -lGL -lpthread -L/usr/X11/lib -lX11 -lm
all: ${SIMON}
simon : libsimon.a simon.o
$(CXX) -o simon simon.o libsimon.a ${LIBS} -L$(HOME)/lib -L/usr/X11R6/lib
simon.o : simon.cxx simon.h
$(CXX) -I. -o simon.o -c simon.cxx
simon_api.o : simon_api.cxx simon.h
$(CXX) -o simon_api.o -c simon_api.cxx
libsimon.a : simon_api.o
ar cru libsimon.a simon_api.o
install: libsimon.a simon.h simon
mkdir -p /usr/local/simon
cp libsimon.a simon.h /usr/local/simon
cp simon /usr/local/bin
uninstall:
rm -r /usr/local/simon
rm /usr/local/bin/simon
clean:
rm -f simon libsimon.a *.o
+231
View File
@@ -0,0 +1,231 @@
/*
S.I.M.O.N - Simple Interface for Making Oliver's programs Nice
Copyright (C) 2002 Steve Baker
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: simon.cxx 1699 2002-09-22 15:22:21Z sjbaker $
*/
#include <simon.h>
#include <plib/psl.h>
pslValue my_print ( int argc, pslValue *argv, pslProgram *p )
{
for ( int i = 0 ; i < argc ; i++ )
{
switch ( argv[i].getType () )
{
case PSL_INT : printf ( "%d ", argv[i].getInt () ) ; break ;
case PSL_FLOAT : printf ( "%f ", argv[i].getFloat () ) ; break ;
case PSL_STRING : printf ( "%s", argv[i].getString () ) ; break ;
case PSL_VOID : printf ( "(void) " ) ; break ;
}
}
pslValue ret ;
return ret ;
}
pslValue my_siJoystickUD ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickUD () ) ;
return ret ;
}
pslValue my_siJoystickLR ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickLR () ) ;
return ret ;
}
pslValue my_siJoystickA ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickA () ) ;
return ret ;
}
pslValue my_siJoystickB ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickB () ) ;
return ret ;
}
pslValue my_siJoystickC ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickC () ) ;
return ret ;
}
pslValue my_siJoystickD ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickD () ) ;
return ret ;
}
pslValue my_siJoystickL ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickL () ) ;
return ret ;
}
pslValue my_siJoystickR ( int, pslValue *, pslProgram * )
{
pslValue ret ;
ret . set ( siJoystickR () ) ;
return ret ;
}
pslValue my_siLoad ( int argc, pslValue *argv, pslProgram *p )
{
if ( argc != 1 || argv[0].getType() != PSL_STRING )
fprintf ( stderr, "siLoad: ERROR - Parameter must be a single string!\n" ) ;
pslValue ret ;
ret . set ( siLoad ( argv[0].getString () ) ) ;
return ret ;
}
pslValue my_fabs ( int argc, pslValue *argv, pslProgram *p )
{
pslValue ret ;
ret . set ( (float) fabs ( argv[0].getFloat () ) ) ;
return ret ;
}
pslValue my_siPosition ( int argc, pslValue *argv, pslProgram *p )
{
if ( argc != 7 )
fprintf ( stderr, "siPosition: ERROR - Expected seven parameters?!?\n" ) ;
siPosition ( argv[0].getInt (),
argv[1].getFloat (),
argv[2].getFloat (),
argv[3].getFloat (),
argv[4].getFloat (),
argv[5].getFloat (),
argv[6].getFloat () ) ;
pslValue ret ;
return ret ;
}
pslExtension extensions [] =
{
{ "siLoad" , 1, my_siLoad },
{ "siPosition" , 7, my_siPosition },
{ "siJoystickUD", 0, my_siJoystickUD },
{ "siJoystickLR", 0, my_siJoystickLR },
{ "siJoystickA" , 0, my_siJoystickA },
{ "siJoystickB" , 0, my_siJoystickB },
{ "siJoystickC" , 0, my_siJoystickC },
{ "siJoystickD" , 0, my_siJoystickD },
{ "siJoystickL" , 0, my_siJoystickL },
{ "siJoystickR" , 0, my_siJoystickR },
{ "fabs" , 1, my_fabs },
{ "print" ,-1, my_print },
{ NULL, 0, NULL }
} ;
pslProgram *prog = NULL ;
ulClock ck ;
int main ( int argc, char **argv )
{
if ( argc != 2 )
{
fprintf ( stderr, "simon: Usage -\n\n" ) ;
fprintf ( stderr, " simon filename\n\n" ) ;
fprintf ( stderr, "Where: 'filename' is a PSL sourcefile\n\n" ) ;
exit ( 1 ) ;
}
pslInit () ;
/* Create program and compile it. */
prog = new pslProgram ( extensions, argv[1] ) ;
ck.setMaxDelta ( 100000.0 ) ;
ck.update () ;
prog -> compile ( argv[1] ) ;
ck.update () ;
fprintf(stderr, "Compile Time: %fs.\n", ck.getDeltaTime () ) ;
fprintf(stderr, "-------------------------------\n" ) ;
siRun () ;
return 0 ;
}
void siUpdate ()
{
static int nframes = 0 ;
static double total_time = 0.0 ;
pslResult res ;
ck.update () ;
do
{
res = prog -> step () ;
} while ( res == PSL_PROGRAM_CONTINUE ) ;
if ( res == PSL_PROGRAM_END )
exit ( 0 ) ;
ck.update () ;
total_time += ck.getDeltaTime () ;
nframes++ ;
if ( nframes == 100 )
{
fprintf ( stderr, "Avg PSL Interp time = %fs.\n", total_time / nframes ) ;
nframes = 0 ;
total_time = 0.0 ;
}
}
+113
View File
@@ -0,0 +1,113 @@
# Microsoft Developer Studio Project File - Name="simon" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=simon - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "simon.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "simon.mak" CFG="simon - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "simon - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "simon - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
F90=df.exe
RSC=rc.exe
!IF "$(CFG)" == "simon - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE F90 /compile_only /nologo /warn:nofileopt
# ADD F90 /compile_only /nologo /warn:nofileopt
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\..\..\..\" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "FREEGLUT_STATIC" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ul.lib js.lib psl.lib ssg.lib sg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /libpath:"..\..\..\..\plib"
!ELSEIF "$(CFG)" == "simon - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE F90 /check:bounds /compile_only /dbglibs /debug:full /nologo /traceback /warn:argument_checking /warn:nofileopt
# ADD F90 /check:bounds /compile_only /dbglibs /debug:full /nologo /traceback /warn:argument_checking /warn:nofileopt
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\..\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "FREEGLUT_STATIC" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ul_d.lib js_d.lib psl_d.lib ssg_d.lib sg_d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib" /pdbtype:sept /libpath:"..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "simon - Win32 Release"
# Name "simon - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp"
# Begin Source File
SOURCE=.\simon.cxx
# End Source File
# Begin Source File
SOURCE=.\simon_api.cxx
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\simon.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
+29
View File
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "simon"=".\simon.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
+83
View File
@@ -0,0 +1,83 @@
/*
S.I.M.O.N - Simple Interface for Making Oliver's programs Nice
Copyright (C) 2002 Steve Baker
This library 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 library 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 library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: simon.h 1681 2002-09-15 02:51:44Z ude $
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <math.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
#include <plib/ssg.h>
#define SI_MAX_MODELS 500
void siUpdate () ;
void siRun () ;
int siLoad ( const char *filename ) ;
void siPosition ( int hh, float x, float y,
float z = 0.0f,
float h = 0.0f,
float p = 0.0f,
float r = 0.0f ) ;
void siSpeedAndDirection ( int hh, float s, float h, float p = 0.0f ) ;
void siVelocity ( int hh, float x, float y,
float z = 0.0f,
float h = 0.0f,
float p = 0.0f,
float r = 0.0f ) ;
float siGetPositionX ( int h ) ;
float siGetPositionY ( int h ) ;
float siGetPositionZ ( int h ) ;
float siGetPositionH ( int h ) ;
float siGetPositionP ( int h ) ;
float siGetPositionR ( int h ) ;
float siJoystickLR () ;
float siJoystickUD () ;
bool siJoystickA () ;
bool siJoystickB () ;
bool siJoystickC () ;
bool siJoystickD () ;
bool siJoystickL () ;
bool siJoystickR () ;
+365
View File
@@ -0,0 +1,365 @@
/*
S.I.M.O.N - Simple Interface for Making Oliver's programs Nice
Copyright (C) 2002 Steve Baker
This library 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 library 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 library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: simon_api.cxx 2100 2006-11-03 22:31:54Z fayjf $
*/
#include "simon.h"
#include <plib/js.h>
#include <plib/ul.h>
#include <plib/ssg.h>
class siEntity ;
static int siNextModel = 0 ;
static bool siInitialised = false ;
static ssgRoot *siScene = NULL ;
static siEntity *siModels [ SI_MAX_MODELS ] ;
class siEntity
{
protected:
int handle ;
char *name ;
sgCoord pos ;
sgCoord vel ;
public:
siEntity ( const char *_fname )
{
siModels [ siNextModel ] = this ;
handle = siNextModel++ ;
if ( siNextModel >= SI_MAX_MODELS )
{
fprintf ( stderr, "simon: ERROR - More than %d models loaded!\n", SI_MAX_MODELS ) ;
exit ( 1 ) ;
}
name = ulStrDup ( _fname ) ;
sgZeroCoord ( & pos ) ;
sgZeroCoord ( & vel ) ;
}
int getHandle () const { return handle ; }
float getPositionX () const { return pos.xyz[0] ; }
float getPositionY () const { return pos.xyz[1] ; }
float getPositionZ () const { return pos.xyz[2] ; }
float getPositionH () const { return pos.hpr[0] ; }
float getPositionP () const { return pos.hpr[1] ; }
float getPositionR () const { return pos.hpr[2] ; }
void setSpeedAndDirection ( float s, float h, float p )
{
sgMat4 tmp ;
sgMakeRotMat4 ( tmp, h, p, 0 ) ;
sgSetVec3 ( vel.xyz, 0, s, 0 ) ;
sgXformPnt3 ( vel.xyz, tmp ) ;
sgSetVec3 ( pos.hpr, h, p, 0 ) ;
sgZeroVec3 ( vel.hpr ) ;
}
void setVelocity ( float x, float y, float z, float h, float p, float r )
{
sgSetCoord ( &vel, x, y, z, h, p, r ) ;
}
void setPosition ( float x, float y, float z, float h, float p, float r )
{
sgSetCoord ( &pos, x, y, z, h, p, r ) ;
}
void updatePhysics ( double dt )
{
sgAddScaledVec3 ( pos . xyz, vel . xyz, (float)dt ) ;
sgAddScaledVec3 ( pos . hpr, vel . hpr, (float)dt ) ;
}
virtual void update ( double dt ) = 0 ;
} ;
class siCamera : public siEntity
{
public:
siCamera () : siEntity ( "Camera" )
{
}
virtual void update ( double dt )
{
updatePhysics ( dt ) ;
ssgSetCamera ( & pos ) ;
}
} ;
class siModel : public siEntity
{
ssgEntity *ent ;
ssgTransform *tra ;
public:
siModel ( const char *_fname ) : siEntity ( _fname )
{
tra = new ssgTransform ;
ent = ssgLoad ( name ) ;
tra -> addKid ( ent ) ;
ssgFlatten ( ent ) ;
ssgStripify ( tra ) ;
siScene -> addKid ( tra ) ;
}
virtual void update ( double dt )
{
updatePhysics ( dt ) ;
tra -> setTransform ( & pos ) ;
}
} ;
static siEntity *getModel ( int i )
{
if ( i < 0 || i >= SI_MAX_MODELS ||
siModels [ i ] == NULL )
{
fprintf ( stderr, "simon: There is no such model as '%d'\n", i ) ;
exit ( 1 ) ;
}
return siModels [ i ] ;
}
float siGetPositionX(int hh) { return getModel ( hh ) -> getPositionX () ; }
float siGetPositionY(int hh) { return getModel ( hh ) -> getPositionY () ; }
float siGetPositionZ(int hh) { return getModel ( hh ) -> getPositionZ () ; }
float siGetPositionH(int hh) { return getModel ( hh ) -> getPositionH () ; }
float siGetPositionP(int hh) { return getModel ( hh ) -> getPositionP () ; }
float siGetPositionR(int hh) { return getModel ( hh ) -> getPositionR () ; }
void siPosition ( int hh, float x, float y, float z,
float h, float p, float r )
{
getModel ( hh ) -> setPosition ( x, y, z, h, p, r ) ;
}
void siSpeedAndDirection ( int hh, float s, float h, float p )
{
getModel ( hh ) -> setSpeedAndDirection ( s, h, p ) ;
}
void siVelocity ( int hh, float x, float y, float z,
float h, float p, float r )
{
getModel ( hh ) -> setVelocity ( x, y, z, h, p, r ) ;
}
/*
The GLUT window reshape event
*/
static void siReshape ( int w, int h )
{
glViewport ( 0, 0, w, h ) ;
}
/*
The GLUT keyboard event
*/
static void siKeyboard ( unsigned char k, int, int )
{
if ( k == 0x03 ) exit ( 0 ) ;
}
static jsJoystick js (0) ;
static bool A, B, C, D, L, R ;
static float leftright ;
static float updown ;
static void read_joystick ()
{
int b ;
float ax [ 10 ] ;
js.read ( &b, ax ) ;
leftright = ax[0] ;
updown = ax[1] ;
A = (( b & 1 ) != 0) ;
B = (( b & 2 ) != 0) ;
C = (( b & 4 ) != 0) ;
D = (( b & 8 ) != 0) ;
R = (( b & 16 ) != 0) ;
L = (( b & 32 ) != 0) ;
}
float siJoystickLR () { return -leftright ; }
float siJoystickUD () { return -updown ; }
bool siJoystickA () { return A ; }
bool siJoystickB () { return B ; }
bool siJoystickC () { return C ; }
bool siJoystickD () { return D ; }
bool siJoystickL () { return L ; }
bool siJoystickR () { return R ; }
/*
The GLUT redraw event
*/
static ulClock *siFrameTimer ;
static void siRedraw ()
{
siFrameTimer -> update () ;
double dt = siFrameTimer -> getDeltaTime () ;
read_joystick () ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
siUpdate () ;
for ( int i = 0 ; i < siNextModel ; i++ )
siModels [ i ] -> update ( dt ) ;
ssgCullAndDraw ( siScene ) ;
glutPostRedisplay () ;
glutSwapBuffers () ;
ulSleep(16);
}
void siInit ()
{
if ( siInitialised )
{
fprintf ( stderr, "simon: ERROR - siInit() was called more than once!\n" ) ;
exit ( 1 ) ;
}
siInitialised = true ;
siFrameTimer = new ulClock ;
siFrameTimer -> update () ;
int fake_argc = 1 ;
char *fake_argv[3] ;
fake_argv[0] = "Simon" ;
fake_argv[1] = "Simon Window." ;
fake_argv[2] = NULL ;
/* Initialise GLUT */
glutInitWindowPosition ( 0, 0 ) ;
glutInitWindowSize ( 600, 600 ) ;
glutInit ( &fake_argc, fake_argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
glutCreateWindow ( fake_argv[1] ) ;
glutDisplayFunc ( siRedraw ) ;
glutReshapeFunc ( siReshape ) ;
glutKeyboardFunc ( siKeyboard ) ;
/* Initialise SSG */
ssgInit () ;
/* Some basic OpenGL setup */
glClearColor ( 0.2f, 0.7f, 1.0f, 1.0f ) ;
glEnable ( GL_DEPTH_TEST ) ;
/* Set up the viewing parameters */
ssgSetFOV ( 90.0f, 90.0f ) ;
ssgSetNearFar ( 0.1f, 700.0f ) ;
/* Set up the Sun. */
sgVec3 sunposn ;
sgSetVec3 ( sunposn, 0.2f, -0.5f, 0.5f ) ;
ssgGetLight ( 0 ) -> setPosition ( sunposn ) ;
/* Set up the path to the data files */
ssgModelPath ( "data" ) ;
ssgTexturePath ( "data" ) ;
/* Create a root node. */
siScene = new ssgRoot ;
for ( int i = 0 ; i < SI_MAX_MODELS ; i++ )
siModels [ i ] = NULL ;
siNextModel = 0 ;
new siCamera () ; /* Thus guaranteeing this is handle zero */
}
/* Load a simple model */
int siLoad ( const char *filename )
{
if ( ! siInitialised )
siInit () ;
siModel *m = new siModel ( filename ) ;
return m -> getHandle () ;
}
void siRun ()
{
if ( ! siInitialised )
siInit () ;
glutMainLoop () ;
}