55
55
# define MODE_moebius
56
# define PROGCLASS "Morph3d"
57
# define HACK_INIT init_morph3d
58
# define HACK_DRAW draw_morph3d
59
# define HACK_RESHAPE reshape
60
# define morph3d_opts xlockmore_opts
61
56
# define DEFAULTS "*delay: 40000 \n" \
62
57
"*showFPS: False \n" \
59
# define refresh_morph3d 0
60
# define morph3d_handle_event 0
64
61
# include "xlockmore.h" /* from the xscreensaver distribution */
65
62
#else /* !STANDALONE */
66
63
# include "xlock.h" /* from the xlockmore distribution */
124
121
int VisibleSpikes;
125
122
void (*draw_object) (ModeInfo * mi);
127
float *MaterialColor[20];
124
const float *MaterialColor[20];
128
125
GLXContext *glx_context;
131
static float front_shininess[] =
133
static float front_specular[] =
134
{0.7, 0.7, 0.7, 1.0};
135
static float ambient[] =
136
{0.0, 0.0, 0.0, 1.0};
137
static float diffuse[] =
138
{1.0, 1.0, 1.0, 1.0};
139
static float position0[] =
140
{1.0, 1.0, 1.0, 0.0};
141
static float position1[] =
142
{-1.0, -1.0, 1.0, 0.0};
143
static float lmodel_ambient[] =
144
{0.5, 0.5, 0.5, 1.0};
145
static float lmodel_twoside[] =
130
static const GLfloat front_shininess[] = {60.0};
131
static const GLfloat front_specular[] = {0.7, 0.7, 0.7, 1.0};
132
static const GLfloat ambient[] = {0.0, 0.0, 0.0, 1.0};
133
static const GLfloat diffuse[] = {1.0, 1.0, 1.0, 1.0};
134
static const GLfloat position0[] = {1.0, 1.0, 1.0, 0.0};
135
static const GLfloat position1[] = {-1.0, -1.0, 1.0, 0.0};
136
static const GLfloat lmodel_ambient[] = {0.5, 0.5, 0.5, 1.0};
137
static const GLfloat lmodel_twoside[] = {GL_TRUE};
148
static float MaterialRed[] =
149
{0.7, 0.0, 0.0, 1.0};
150
static float MaterialGreen[] =
151
{0.1, 0.5, 0.2, 1.0};
152
static float MaterialBlue[] =
153
{0.0, 0.0, 0.7, 1.0};
154
static float MaterialCyan[] =
155
{0.2, 0.5, 0.7, 1.0};
156
static float MaterialYellow[] =
157
{0.7, 0.7, 0.0, 1.0};
158
static float MaterialMagenta[] =
159
{0.6, 0.2, 0.5, 1.0};
160
static float MaterialWhite[] =
161
{0.7, 0.7, 0.7, 1.0};
162
static float MaterialGray[] =
163
{0.5, 0.5, 0.5, 1.0};
139
static const GLfloat MaterialRed[] = {0.7, 0.0, 0.0, 1.0};
140
static const GLfloat MaterialGreen[] = {0.1, 0.5, 0.2, 1.0};
141
static const GLfloat MaterialBlue[] = {0.0, 0.0, 0.7, 1.0};
142
static const GLfloat MaterialCyan[] = {0.2, 0.5, 0.7, 1.0};
143
static const GLfloat MaterialYellow[] = {0.7, 0.7, 0.0, 1.0};
144
static const GLfloat MaterialMagenta[] = {0.6, 0.2, 0.5, 1.0};
145
static const GLfloat MaterialWhite[] = {0.7, 0.7, 0.7, 1.0};
146
static const GLfloat MaterialGray[] = {0.5, 0.5, 0.5, 1.0};
165
148
static morph3dstruct *morph3d = (morph3dstruct *) NULL;
273
256
GLfloat Zf=(Edge)*(Z); \
274
257
GLfloat AmpVr2=(Amp)/sqr((Edge)*cossec36_2); \
276
static GLfloat x[6],y[6]; \
277
static int arrayninit=1; \
280
for(Fi=0;Fi<6;Fi++) { \
281
x[Fi]=-cos( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
282
y[Fi]=sin( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
261
for(Fi=0;Fi<6;Fi++) { \
262
x[Fi]=-cos( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
263
y[Fi]=sin( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
287
266
for (Ri=1; Ri<=(Divisions); Ri++) { \
291
270
Xf=(float)(Ri-Ti)*x[Fi] + (float)Ti*x[Fi+1]; \
292
271
Yf=(float)(Ri-Ti)*y[Fi] + (float)Ti*y[Fi+1]; \
293
272
Xa=Xf+0.001; Yb=Yf+0.001; \
294
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
295
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
296
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
273
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
274
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
275
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
297
276
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
298
277
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
299
278
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
604
583
TRIANGLE(1.5, mp->seno, mp->edgedivisions, (3 * SQRT3 + SQRT15) / 12, mp->VisibleSpikes);
608
reshape(ModeInfo * mi, int width, int height)
587
reshape_morph3d(ModeInfo * mi, int width, int height)
610
589
morph3dstruct *mp = &morph3d[MI_SCREEN(mi)];