back to the text
/*----------------------------------------------------
 * 
 * GALLERY.c - app variables and draw functions
 * 
 *--------------------------------------------------*/

#include "INCLUDES.h"
							
static int eye = 0;
static int CNT = 0;
static int CUBICTURN = 0;
static float alphalabel[4] = {1.0, 1.0, 1.0, 1.0};
static float labelCNT=1;


void sky();
void floor();
void walls();
void photos();
void labels();
void sculpture();
void cubelines();

/*--------------------------------------------------*/
/*--------------------------------------------------*/
/*--------------------------------------------------*/
/*--------------------------------------------------*/
/*----------------------------------------------------
 * 
 * DRAW functions
 * 
 *--------------------------------------------------*/

void draw_GALLERY()
{
	float dummy[1] = {0.0};							
	float fog[5] = {10.0, 40.0, .2, 0.0, 0.0};
	fogvertex(FG_VTX_LIN, fog);
	cpack(0xff1010a0); clear(); zclear();

	rotate(-150,'x');
	translate(0.0, .75, 0.0);
	scale(0.65, 0.65, 0.65);

	CAVENavTransform();
	fogvertex(FG_ON,dummy);  
		
	/*----------------------------*/
		
	texbind(TX_TEXTURE_0, img_list[94]);	
		sky();
	texbind(TX_TEXTURE_0, 0);

	fogvertex(FG_OFF,dummy);
	
	/*----------------------------*/
	
	cubelines();
	
	/*----------------------------*/
	
	fogvertex(FG_ON,dummy); 	
	
	blendfunction(BF_SA, BF_MSA);	
	texbind(TX_TEXTURE_0, img_list[92]);
		floor();
	texbind(TX_TEXTURE_0, 0);
	blendfunction(BF_ONE, BF_ZERO);
	
	/*----------------------------*/
		
		walls();
			pushmatrix();			 
				rotate(900,'y');
				 walls();
				rotate(900,'y');
				 walls();
				rotate(900,'y');
				 walls();
			popmatrix();
			
	fogvertex(FG_OFF,dummy);
	
	/*----------------------------*/
		
		photos();
	
	/*----------------------------*/
	blendfunction(BF_SA, BF_MSA);	
		labels();
	blendfunction(BF_ONE, BF_ZERO);
	/*----------------------------*/	
	
	msalpha(MSA_MASK);
	texbind(TX_TEXTURE_0, img_list[93]);			
		sculpture();							
	texbind(TX_TEXTURE_0, 0);
	msalpha(MSA_ALPHA);
	
	/*----------------------------*/
	
	
	if(eye)
	{		
		CUBICTURN = CUBICTURN - 10;
		if (CUBICTURN>=3600) CUBICTURN = 0;
		
		CNT = CNT + 4;
		if (CNT >3600) CNT = 0;
		
		
		labelCNT = labelCNT + .5;	
		if (labelCNT < 1 && labelCNT > 0) alphalabel[3] = 0.1;							
			else if (labelCNT < 2 && labelCNT > 1) alphalabel[3] = 0.2;
			else if (labelCNT < 3 && labelCNT > 2) alphalabel[3] = 0.3;
			else if (labelCNT < 4 && labelCNT > 3) alphalabel[3] = 0.4;
			else if (labelCNT < 5 && labelCNT > 4) alphalabel[3] = 0.5;
			else if (labelCNT < 6 && labelCNT > 5) alphalabel[3] = 0.6;
			else if (labelCNT < 7 && labelCNT > 6) alphalabel[3] = 0.7;
			else if (labelCNT < 8 && labelCNT > 7) alphalabel[3] = 0.8;
			else if (labelCNT < 9 && labelCNT > 8) alphalabel[3] = 0.9;
			else if (labelCNT < 15 && labelCNT > 9) alphalabel[3] = 1.0;
			else if (labelCNT < 16 && labelCNT > 15) alphalabel[3] = 0.9;
			else if (labelCNT < 17 && labelCNT > 16) alphalabel[3] = 0.8;
			else if (labelCNT < 18 && labelCNT > 17) alphalabel[3] = 0.7;
			else if (labelCNT < 19 && labelCNT > 18) alphalabel[3] = 0.6;
			else if (labelCNT < 20 && labelCNT > 19) alphalabel[3] = 0.5;
			else if (labelCNT < 21 && labelCNT > 20) alphalabel[3] = 0.4;
			else if (labelCNT < 22 && labelCNT > 21) alphalabel[3] = 0.3;
			else if (labelCNT < 23 && labelCNT > 22) alphalabel[3] = 0.2;
			else if (labelCNT < 24 && labelCNT > 23) alphalabel[3] = 0.1;
			else if (labelCNT < 25 && labelCNT > 24) alphalabel[3] = 0.0;
			else if (labelCNT >= 35)
			{
				alphalabel[3] = 0.1;
				labelCNT = 0;
			}
			
	
	}
	
	eye=!eye;
	
	
}

/*--------------------------------------------------*/

void sky()
{
	cpack(0xffffffff);
	pushmatrix();							
		translate(0.0, 16.0, 0.0);
		rotate(900,'x');
		scale(150.0, 150.0, 0.0);
		callobj(GLobjSqrIndex);
	popmatrix();
}

/*--------------------------------------------------*/

void floor()
{
	cpack(0xffffffff);
	pushmatrix();							
		translate(0.0, -5.0, 0.0);
		rotate(900,'x');
		scale(150.0, 150.0, 0.0);
		callobj(GLobjSqrIndex);
	popmatrix();
}

/*--------------------------------------------------*/

void walls()
{
	cpack(0xff101090);
	pushmatrix();							
		translate(0.0, 0.0, -150.0);
		scale(155.0, 40.0, 0.0);
		callobj(GLobjSqrIndex);
	popmatrix();
	
}

/*--------------------------------------------------*/

void photos()
{	
	texbind(TX_TEXTURE_0, img_list[86]); /* 1 */
		pushmatrix();							
			 cpack(0xffffffff);
			 translate(-70.5, 4.0, 20.5);
			 rotate(-450,'y');				
			 scale(-12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[87]); /* 2 */
		pushmatrix();							
			 cpack(0xffffffff);
			 translate(-70.5, 4.0, -20.5);		
			 rotate(450,'y');						
			 scale(12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[88]); /* 3 */
		pushmatrix();							
			 cpack(0xffffffff);
			 translate(0.0, 4.0, -45.5);
			 scale(-12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[89]); /* 4 */		
		pushmatrix();							
			 cpack(0xffffffff);
			 translate(70.5, 4.0, -20.5);
			 rotate(-450,'y');					
			 scale(-12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[90]); /* 5 */
		pushmatrix();							
			 cpack(0xffffffff);
			 translate(70.5, 4.0, 20.5);
			 rotate(450,'y');				
			 scale(12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);	
	
	texbind(TX_TEXTURE_0, img_list[91]);	/* 6 */
		pushmatrix();							
			 cpack(0xffffffff);
			 translate(0.0, 4.0, 45.5);		
			 scale(12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(0, 0);	
}

/*--------------------------------------------------*/

void labels()
{	
	texbind(TX_TEXTURE_0, img_list[113]); /* 1 */
		pushmatrix();							
			 c4f(alphalabel);
			 translate(-70.0, 4.0, 20.0);
			 rotate(-450,'y');				
			 scale(12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[114]); /* 2 */
		pushmatrix();							
			 c4f(alphalabel);
			 translate(-70.0, 4.0, -20.0);		
			 rotate(450,'y');						
			 scale(-12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[112]); /* 3 */
		pushmatrix();							
			 c4f(alphalabel);
			 translate(0.0, 4.0, -45.0);
			 scale(-12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[115]); /* 4 */		
		pushmatrix();							
			 c4f(alphalabel);
			 translate(70.0, 4.0, -20.0);
			 rotate(-450,'y');					
			 scale(-12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);
	
	texbind(TX_TEXTURE_0, img_list[117]); /* 5 */
		pushmatrix();							
			 c4f(alphalabel);
			 translate(70.0, 4.0, 20.0);
			 rotate(450,'y');				
			 scale(12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(TX_TEXTURE_0, 0);	
	
	texbind(TX_TEXTURE_0, img_list[116]);	/* 6 */
		pushmatrix();							
			 c4f(alphalabel);
			 translate(0.0, 4.0, 45.0);		
			 scale(12.0, -8.0, 0.0);
			 callobj(GLobjSqrIndex);
		popmatrix();
	texbind(0, 0);	
}

/*--------------------------------------------------*/

void sculpture()
{	
	cpack(0xffffffff);
	pushmatrix();		 						
		translate(20.0, 2.0, 0.0);
		rotate(-CNT,'y');
		scale(0.05, 0.05, 0.05);
		callobj(GLobjsculptureIndex);	 
	popmatrix();
	
	pushmatrix();		 						
		translate(-20.0, 2.0, 0.0);
		rotate(CNT,'y');
		scale(0.04, 0.04, 0.04);
		callobj(GLobjsculpture2Index);	 
	popmatrix();

}

/*--------------------------------------------------*/

void cubelines()
{

	pushmatrix();
		translate(0.0, -82.0, 0.0);
		scale(25.0, 15.0, 25.0);
		rotate(CUBICTURN,'y');
		callobj(GLobjcubicvolumeIndex);
	popmatrix();
	
}

/*--------------------------------------------------*/