914e5c1039fe50c4afe447d2e532ba221ab9bcef
[xscreensaver] / hacks / glx / atlantis.h
1 /* atlantis --- Shows moving 3D sea animals */
2
3 /* Copyright (c) E. Lassauge, 1998. */
4
5 /*
6  * Permission to use, copy, modify, and distribute this software and its
7  * documentation for any purpose and without fee is hereby granted,
8  * provided that the above copyright notice appear in all copies and that
9  * both that copyright notice and this permission notice appear in
10  * supporting documentation.
11  *
12  * This file is provided AS IS with no warranties of any kind.  The author
13  * shall have no liability with respect to the infringement of copyrights,
14  * trade secrets or any patents by this file or any part thereof.  In no
15  * event will the author be liable for any lost revenue or profits or
16  * other special, indirect and consequential damages.
17  *
18  * The original code for this mode was written by Mark J. Kilgard
19  * as a demo for openGL programming.
20  * 
21  * Porting it to xlock  was possible by comparing the original Mesa's morph3d 
22  * demo with it's ported version to xlock, so thanks for Marcelo F. Vianna 
23  * (look at morph3d.c) for his indirect help.
24  *
25  * Thanks goes also to Brian Paul for making it possible and inexpensive
26  * to use OpenGL at home.
27  *
28  * My e-mail address is lassauge@sagem.fr
29  *
30  * Eric Lassauge  (May-13-1998)
31  *
32  */
33
34 /**
35  * (c) Copyright 1993, 1994, Silicon Graphics, Inc.
36  * ALL RIGHTS RESERVED
37  * Permission to use, copy, modify, and distribute this software for
38  * any purpose and without fee is hereby granted, provided that the above
39  * copyright notice appear in all copies and that both the copyright notice
40  * and this permission notice appear in supporting documentation, and that
41  * the name of Silicon Graphics, Inc. not be used in advertising
42  * or publicity pertaining to distribution of the software without specific,
43  * written prior permission.
44  *
45  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
46  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
47  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
48  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
49  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
50  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
51  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
52  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
53  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
54  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
55  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
56  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
57  *
58  * US Government Users Restricted Rights
59  * Use, duplication, or disclosure by the Government is subject to
60  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
61  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
62  * clause at DFARS 252.227-7013 and/or in similar or successor
63  * clauses in the FAR or the DOD or NASA FAR Supplement.
64  * Unpublished-- rights reserved under the copyright laws of the
65  * United States.  Contractor/manufacturer is Silicon Graphics,
66  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
67  *
68  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
69  */
70 #include <GL/gl.h>
71 #include <GL/glx.h>
72
73 #define RAD 57.295
74 #define RRAD 0.01745
75
76 #define NUM_SHARKS 4
77 #define SHARKSIZE 6000
78 #define SHARKSPEED 100.0
79
80 #define WHALESPEED 250.0
81
82 typedef struct _fishRec {
83     float x, y, z, phi, theta, psi, v;
84     float xt, yt, zt;
85     float htail, vtail;
86     float dtheta;
87     int spurt, attack;
88 } fishRec;
89
90 typedef struct {
91         GLint       WinH, WinW;
92         GLXContext *glx_context;
93         fishRec sharks[NUM_SHARKS];
94         fishRec momWhale;
95         fishRec babyWhale;
96         fishRec dolph;
97 } atlantisstruct;
98
99 extern void FishTransform(fishRec *);
100 extern void WhalePilot(fishRec *);
101 extern void SharkPilot(fishRec *);
102 extern void SharkMiss(atlantisstruct *,int);
103 extern void DrawWhale(fishRec *);
104 extern void DrawShark(fishRec *);
105 extern void DrawDolphin(fishRec *);