コード例 #1
0
static Bool
elementsPaintOutput (CompScreen              *s,
		 const ScreenPaintAttrib *sa,
		 const CompTransform	 *transform,
		 Region                  region,
		 CompOutput              *output,
		 unsigned int            mask)
{
	CompDisplay *d = s->display;
	Bool status;
	Bool active = elementActive(s);

	E_SCREEN (s);

	UNWRAP (eScreen, s, paintOutput);
	status = (*s->paintOutput) (s, sa, transform, region, output, mask);
	WRAP (eScreen, s, paintOutput, elementsPaintOutput);

	if(elementsGetApplyTransform (d))
		return status;

	if (active && elementsGetOverWindows (d))
	{
		CompTransform sTransform = *transform;
		transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
		glPushMatrix ();
		glLoadMatrixf (sTransform.m);
		beginRendering (s);
		glPopMatrix ();
	}

    return status;
}
コード例 #2
0

static Bool
elementsDrawWindow (CompWindow           *w,
		const CompTransform  *transform,
		const FragmentAttrib *attrib,
		Region               region,
		unsigned int         mask)
{
	Bool status;

	E_SCREEN (w->screen);
	Bool active = FALSE;
	int ii;
	for (ii = 0; ii <= 4; ii++)
	{
		if (eScreen->isActive[ii])
			active = TRUE;
	}
	UNWRAP (eScreen, w->screen, drawWindow);
	status = (*w->screen->drawWindow) (w, transform, attrib, region, mask);
	WRAP (eScreen, w->screen, drawWindow, elementsDrawWindow);

	if (active && (w->type & CompWindowTypeDesktopMask) && 
		!elementsGetOverWindows (w->screen->display))
	{
		beginRendering (eScreen, w->screen);
	}
コード例 #3
0
static Bool
elementsBubblesToggle (CompDisplay     *d,
	    CompAction      *action,
	    CompActionState state,
	    CompOption      *option,
	    int             nOption)
{
	Bool useKeys = FALSE;
	CompScreen *s;
	for (s = d->screens; s; s = s->next)
	{
		E_SCREEN (s);
		useKeys = eScreen->useKeys;
		if (useKeys)
		{
			eScreen->isActive[4] = !eScreen->isActive[4];
			damageScreen (s);
			eScreen->needUpdate = TRUE;
		}
	}
	if (useKeys)
	{
		createAll( d );
	}
	return TRUE;
}
コード例 #4
0
static Bool
stepPositions(void *closure)
{
	CompScreen *s = closure;
	int i, ii, numSnow, numAutumn, numStars, numFf, numBubbles, numTmp;
	element *ele;
	Bool onTopOfWindows;
	E_SCREEN(s);

	Bool active = FALSE;			//THis makes sure nothing happens if all features are off.
	for (ii = 0; ii <= 4; ii++)
	{
		if (eScreen->isActive[ii])
			active = TRUE;
	}

	if (!active)
		return TRUE;

	ele = eScreen->allElements;

	if (eScreen->isActive[0])
		numAutumn = elementsGetNumLeaves (s->display);	
	else
		numAutumn = 0;
	if (eScreen->isActive[1])
		numFf = elementsGetNumFireflies (s->display);
	else
		numFf = 0;
	if (eScreen->isActive[2])
		numSnow = elementsGetNumSnowflakes (s->display);
	else
		numSnow = 0;
	if (eScreen->isActive[3])
		numStars = elementsGetNumStars (s->display);
	else
		numStars = 0;
	if (eScreen->isActive[4])
		numBubbles = elementsGetNumBubbles (s->display);
	else
		numBubbles = 0;

	numTmp = numAutumn + numFf + numSnow + numStars + numBubbles;
	onTopOfWindows = elementsGetOverWindows (s->display);
	for (i = 0; i < numTmp; i++)
		elementTestCreate(eScreen, ele++);
	if (active && !onTopOfWindows )
	{
		CompWindow *w;
		for (w = s->windows; w; w = w->next)
		{
			if (w->type & CompWindowTypeDesktopMask)
				addWindowDamage (w);
		}
    	}
	else if (active)
		damageScreen (s);

	return TRUE;
コード例 #5
0
static Bool
stepPositions(CompScreen *s, int elapsed)
{
	int i, numSnow, numAutumn, numStars, numFf, numBubbles, numTmp;
	element *ele;
	Bool onTopOfWindows;
	Bool active = elementActive(s);

	E_SCREEN(s);

	if (!active)
		return TRUE;

	ele = eScreen->allElements;

	if (eScreen->isActive[0])
		numAutumn = elementsGetNumLeaves (s->display);
	else
		numAutumn = 0;
	if (eScreen->isActive[1])
		numFf = elementsGetNumFireflies (s->display);
	else
		numFf = 0;
	if (eScreen->isActive[2])
		numSnow = elementsGetNumSnowflakes (s->display);
	else
		numSnow = 0;
	if (eScreen->isActive[3])
		numStars = elementsGetNumStars (s->display);
	else
		numStars = 0;
	if (eScreen->isActive[4])
		numBubbles = elementsGetNumBubbles (s->display);
	else
		numBubbles = 0;

	numTmp = numAutumn + numFf + numSnow + numStars + numBubbles;
	onTopOfWindows = elementsGetOverWindows (s->display);
	for (i = 0; i < numTmp; i++)
		elementTestCreate(eScreen, ele++, elapsed);
	if (active)
	{
		CompWindow *w;
		for (w = s->windows; w; w = w->next)
		{
			if (!onTopOfWindows && (w->type & CompWindowTypeDesktopMask))
				addWindowDamage (w);
			else if (onTopOfWindows && isNormalWin(w)) {
				eScreen->topWindow = w;
				addWindowDamage (w);
			}
		}

		damageScreen (s);
	}

	return TRUE;
}
コード例 #6
0
static void
elementsDonePaintScreen (CompScreen *s)
{
	E_SCREEN (s);

	if (elementActive(s))
		damageScreen (s);

	UNWRAP (eScreen, s, donePaintScreen);
	(*s->donePaintScreen) (s);
	WRAP (eScreen, s, donePaintScreen, elementsDonePaintScreen);
}
コード例 #7
0
static void
elementsPreparePaintScreen (CompScreen *s,
                            int elapsed)
{
	E_SCREEN (s);

	if (elementActive(s))
		stepPositions (s, elapsed);

    UNWRAP (eScreen, s, preparePaintScreen);
    (*s->preparePaintScreen) (s, elapsed);
    WRAP (eScreen, s, preparePaintScreen, elementsPreparePaintScreen);
}
コード例 #8
0
static Bool
elementActive (CompScreen *s)
{
	int i;

	E_SCREEN (s);

	for (i = 0; i <= 4; i++)
		if (eScreen->isActive[i])
			return TRUE;

	return FALSE;
}
コード例 #9
0
static Bool
elementsDrawWindow (CompWindow           *w,
		const CompTransform  *transform,
		const FragmentAttrib *attrib,
		Region               region,
		unsigned int         mask)
{
	CompScreen *s = w->screen;
	CompDisplay *d = s->display;
	Bool active = elementActive(s);
	Bool status = FALSE;

	E_SCREEN (s);

	if (active) {
		Bool applyTransform = elementsGetApplyTransform (d);
		Bool onTop = elementsGetOverWindows (d);
		Bool isDesktop = (w->type & CompWindowTypeDesktopMask) && !onTop;
		Bool isTopMost = w && (w == eScreen->topWindow) && onTop;

		if (isDesktop) {
			UNWRAP (eScreen, s, drawWindow);
			status = (*s->drawWindow) (w, transform, attrib, region, mask);
			WRAP (eScreen, s, drawWindow, elementsDrawWindow);
			beginRendering (s);
		} else if (isTopMost && applyTransform) {
			UNWRAP (eScreen, s, drawWindow);
			status = (*s->drawWindow) (w, transform, attrib, region, mask);
			WRAP (eScreen, s, drawWindow, elementsDrawWindow);
			beginRendering (s);
		} else {
			UNWRAP (eScreen, s, drawWindow);
			status = (*s->drawWindow) (w, transform, attrib, region, mask);
			WRAP (eScreen, s, drawWindow, elementsDrawWindow);
		}
	} else {
		UNWRAP (eScreen, s, drawWindow);
		status = (*s->drawWindow) (w, transform, attrib, region, mask);
		WRAP (eScreen, s, drawWindow, elementsDrawWindow);
	}

	return status;
}
コード例 #10
0

static Bool
elementsPaintOutput (CompScreen              *s,
		 const ScreenPaintAttrib *sa,
		 const CompTransform	 *transform,
		 Region                  region,
		 CompOutput              *output, 
		 unsigned int            mask)
{
	Bool status;

	E_SCREEN (s);
	int ii;
	Bool active = FALSE;
	for (ii = 0; ii <= 4; ii++)
	{
		if (eScreen->isActive[ii])
			active = TRUE;
	}

	if (active && elementsGetOverWindows (s->display))
		mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;

	UNWRAP (eScreen, s, paintOutput);
	status = (*s->paintOutput) (s, sa, transform, region, output, mask);
	WRAP (eScreen, s, paintOutput, elementsPaintOutput);

	if (active && elementsGetOverWindows (s->display))
	{
		CompTransform sTransform = *transform;
		transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
		glPushMatrix ();
		glLoadMatrixf (sTransform.m);
		beginRendering (eScreen, s);
		glPopMatrix ();
	}
コード例 #11
0
static void
elementsFiniScreen (CompPlugin *p,
		CompScreen *s)
{
	int i;

	E_SCREEN (s);

	for (i = 0; i < eScreen->numElements; i++)
	{
		finiTexture (s, &eScreen->textu[i].tex);
		glDeleteLists (eScreen->textu[i].dList, 1);
	}

	if (eScreen->textu)
		free (eScreen->textu);

	UNWRAP (eScreen, s, preparePaintScreen);
	UNWRAP (eScreen, s, donePaintScreen);
	UNWRAP (eScreen, s, paintOutput);
	UNWRAP (eScreen, s, drawWindow);
	free (eScreen);
}
コード例 #12
0
static void
updateElementTextures (CompScreen *s, Bool changeTextures)
{
	int       i, count = 0;
	float     autumnSize = elementsGetLeafSize(s->display);
	float     ffSize = elementsGetFireflySize(s->display);
	float     snowSize = elementsGetSnowSize(s->display);
	float     starsSize = elementsGetStarsSize(s->display);
	float     bubblesSize = elementsGetBubblesSize(s->display);
	element *ele;

	E_SCREEN (s);
	E_DISPLAY (s->display);
	int numAutumn, numFf, numSnow, numStars, numBubbles;

	if (eScreen->isActive[0])
		numAutumn = elementsGetNumLeaves (s->display);
	else
		numAutumn = 0;
	if (eScreen->isActive[1])
		numFf = elementsGetNumFireflies (s->display);
	else
		numFf = 0;
	if (eScreen->isActive[2])
		numSnow = elementsGetNumSnowflakes (s->display);
	else
		numSnow = 0;
	if (eScreen->isActive[3])
		numStars = elementsGetNumStars (s->display);
	else
		numStars = 0;
	if (eScreen->isActive[4])
		numBubbles = elementsGetNumBubbles (s->display);
	else
		numBubbles = 0;
	ele = eScreen->allElements;
	if (changeTextures)
	{
	for (i = 0; i < eScreen->numElements; i++)
	{
		finiTexture (s, &eScreen->textu[i].tex);
		glDeleteLists (eScreen->textu[i].dList, 1);
	}

	if (eScreen->textu)
		free (eScreen->textu);
	eScreen->numElements = 0;
	eScreen->numTexLoaded[0] = 0;
	eScreen->numTexLoaded[1] = 0;
	eScreen->numTexLoaded[2] = 0;
	eScreen->numTexLoaded[3] = 0;
	eScreen->numTexLoaded[4] = 0;
	eScreen->textu = calloc (1, sizeof (texture) * (ed->numTex[0] + ed->numTex[1] + ed->numTex[2] + ed->numTex[3] + ed->numTex[4]));
	}
	for (i = 0; i < ed->numTex[0]; i++)
	{
		CompMatrix  *mat;
		texture *aTex;
	if (changeTextures)
	{
		eScreen->textu[count].loaded =
		    readImageToTexture (s, &eScreen->textu[count].tex,
					ed->texFiles[0][i].s,
					&eScreen->textu[count].width,
					&eScreen->textu[count].height);
		if (!eScreen->textu[count].loaded)
		{
		    compLogMessage ("Elements", CompLogLevelWarn,
			    "Texture (Autumn) not found : %s", ed->texFiles[0][i].s);
		    continue;
		}
		compLogMessage ("Elements", CompLogLevelInfo,
			"Loaded Texture (Autumn)%s", ed->texFiles[0][i].s);
		}
		mat = &eScreen->textu[count].tex.matrix;
		aTex = &eScreen->textu[count];
		aTex->dList = glGenLists (1);
		glNewList (aTex->dList, GL_COMPILE);

		glBegin (GL_QUADS);

		glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (0, 0);
		glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
			      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (0, autumnSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
			      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (autumnSize, autumnSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
			      COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (autumnSize, 0);

		glEnd ();
		glEndList ();

		count++;
	}
	if (changeTextures)
		eScreen->numTexLoaded[0] = count;
	for (i = 0; i < ed->numTex[1]; i++)
	{
		CompMatrix  *mat;
		texture *aTex;
		if (changeTextures)
		{
		eScreen->textu[count].loaded =
		readImageToTexture (s, &eScreen->textu[count].tex,
				ed->texFiles[1][i].s,
				&eScreen->textu[count].width,
				&eScreen->textu[count].height);
		if (!eScreen->textu[count].loaded)
		{
		    compLogMessage ("Elements", CompLogLevelWarn,
			    "Texture (Firefly) not found : %s", ed->texFiles[1][i].s);
		    continue;
		}
		compLogMessage ("Elements", CompLogLevelInfo,
			"Loaded Texture (Firefly) %s", ed->texFiles[1][i].s);
		}
		mat = &eScreen->textu[count].tex.matrix;
		aTex = &eScreen->textu[count];

		aTex->dList = glGenLists (1);
		glNewList (aTex->dList, GL_COMPILE);

		glBegin (GL_QUADS);

		glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (0, 0);
		glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
		      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (0, ffSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
			      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (ffSize, ffSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
			      COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (ffSize, 0);

		glEnd ();
		glEndList ();

		count++;
	}
	if (changeTextures)
	eScreen->numTexLoaded[1] = count - eScreen->numTexLoaded[0];
	for (i = 0; i < ed->numTex[2]; i++)
	{
		CompMatrix  *mat;
		texture *aTex;
	if (changeTextures)
	{
		eScreen->textu[count].loaded =
		readImageToTexture (s, &eScreen->textu[count].tex,
				ed->texFiles[2][i].s,
				&eScreen->textu[count].width,
				&eScreen->textu[count].height);
		if (!eScreen->textu[count].loaded)
		{
			compLogMessage ("Elements", CompLogLevelWarn,
			    "Texture (snow) not found : %s", ed->texFiles[2][i].s);
			continue;
		}
		compLogMessage ("Elements", CompLogLevelInfo,
			"Loaded Texture (snow) %s", ed->texFiles[2][i].s);
	}
		mat = &eScreen->textu[count].tex.matrix;
		aTex = &eScreen->textu[count];

		aTex->dList = glGenLists (1);
		glNewList (aTex->dList, GL_COMPILE);

		glBegin (GL_QUADS);

		glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (0, 0);
		glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
		      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (0, snowSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
		      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (snowSize, snowSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
		      COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (snowSize, 0);

		glEnd ();
		glEndList ();

		count++;
	}
	if (changeTextures)
	eScreen->numTexLoaded[2] = count - eScreen->numTexLoaded[0] -eScreen->numTexLoaded[1];
	for (i = 0; i < ed->numTex[3]; i++)
	{
		CompMatrix  *mat;
		texture *aTex;
	if (changeTextures)
	{
		eScreen->textu[count].loaded =
		readImageToTexture (s, &eScreen->textu[count].tex,
				ed->texFiles[3][i].s,
				&eScreen->textu[count].width,
				&eScreen->textu[count].height);
		if (!eScreen->textu[count].loaded)
		{
			compLogMessage ("Elements", CompLogLevelWarn,
			    "Texture (stars) not found : %s", ed->texFiles[3][i].s);
			continue;
		}
		compLogMessage ("Elements", CompLogLevelInfo,
			"Loaded Texture (stars)%s", ed->texFiles[3][i].s);
	}
		mat = &eScreen->textu[count].tex.matrix;
		aTex = &eScreen->textu[count];

		aTex->dList = glGenLists (1);
		glNewList (aTex->dList, GL_COMPILE);

		glBegin (GL_QUADS);

		glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (0, 0);
		glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
		      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (0, starsSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
		      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (starsSize, starsSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
		      COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (starsSize, 0);

		glEnd ();
		glEndList ();

		count++;
	}
	if (changeTextures)
	eScreen->numTexLoaded[3] = count - eScreen->numTexLoaded[0] - eScreen->numTexLoaded[1] - eScreen->numTexLoaded[2];
	for (i = 0; i < ed->numTex[4]; i++)
	{
		CompMatrix  *mat;
		texture *aTex;
	if (changeTextures)
	{
		eScreen->textu[count].loaded =
		readImageToTexture (s, &eScreen->textu[count].tex,
				ed->texFiles[4][i].s,
				&eScreen->textu[count].width,
				&eScreen->textu[count].height);
		if (!eScreen->textu[count].loaded)
		{
			compLogMessage ("Elements", CompLogLevelWarn,
			    "Texture (bubbles) not found : %s", ed->texFiles[4][i].s);
			continue;
		}
		compLogMessage ("Elements", CompLogLevelInfo,
			"Loaded Texture (bubbles)%s", ed->texFiles[4][i].s);
	}
		mat = &eScreen->textu[count].tex.matrix;
		aTex = &eScreen->textu[count];

		aTex->dList = glGenLists (1);
		glNewList (aTex->dList, GL_COMPILE);

		glBegin (GL_QUADS);

		glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (0, 0);
		glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
		      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (0, bubblesSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
		      COMP_TEX_COORD_Y (mat, aTex->height));
		glVertex2f (bubblesSize, bubblesSize * aTex->height / aTex->width);
		glTexCoord2f (COMP_TEX_COORD_X (mat, aTex->width),
		      COMP_TEX_COORD_Y (mat, 0));
		glVertex2f (bubblesSize, 0);

		glEnd ();
		glEndList ();

		count++;
	}
	if (changeTextures)
	{
	eScreen->numTexLoaded[4] = count - eScreen->numTexLoaded[0] - eScreen->numTexLoaded[1] - eScreen->numTexLoaded[2] - eScreen->numTexLoaded[3];

//	if (count < (ed->numTex[0] + ed->numTex[1] + ed->numTex[2] + ed->numTex[3] + ed->numTex[4]))
		eScreen->textu = realloc (eScreen->textu, sizeof (texture) * count);

	eScreen->numElements = count;

	for (i = 0; i < (numAutumn + numFf + numSnow + numStars + numBubbles); i++)
		setElementTexture (eScreen, ele++);
	}
}
コード例 #13
0
static void
beginRendering (CompScreen *s)
{
	int j;

	E_SCREEN (s);

	glEnable (GL_BLEND);
	glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

	if (eScreen->needUpdate)
	{
		setupDisplayList (eScreen);
		eScreen->needUpdate = FALSE;
	}

	glColor4f (1.0, 1.0, 1.0, 1.0);
	for (j = 0; j < eScreen->numElements; j++)
		{
			element *ele = eScreen->allElements;
			int i, numAutumn, numFf, numSnow, numStars, numBubbles;
			if (eScreen->isActive[0])
				numAutumn = elementsGetNumLeaves (s->display);
			else
				numAutumn = 0;
			if (eScreen->isActive[1])
				numFf = elementsGetNumFireflies (s->display);
			else
				numFf = 0;
			if (eScreen->isActive[2])
				numSnow = elementsGetNumSnowflakes (s->display);
			else
				numSnow = 0;
			if (eScreen->isActive[3])
				numStars = elementsGetNumStars (s->display);
			else
				numStars = 0;
			if (eScreen->isActive[4])
				numBubbles = elementsGetNumBubbles (s->display);
			else
				numBubbles = 0;

			int numTmp = numAutumn + numFf + numSnow + numStars + numBubbles;
			Bool autumnRotate = elementsGetAutumnRotate (s->display);
			Bool snowRotate = elementsGetSnowRotate (s->display);
			Bool ffRotate = elementsGetFirefliesRotate (s->display);
			Bool starsRotate = elementsGetStarsRotate (s->display);
			Bool bubblesRotate = elementsGetBubblesRotate (s->display);

			enableTexture (eScreen->cScreen, &eScreen->textu[j].tex,
			   COMP_TEXTURE_FILTER_GOOD);

			for (i = 0; i < numTmp; i++)
			{
				if (ele->eTex == &eScreen->textu[j])
				{
					glTranslatef (ele->x, ele->y, ele->z);
					if (autumnRotate && ele->type == 0)
						glRotatef (ele->rAngle, 0, 0, 1);
					if (ffRotate && ele->type == 1)
						glRotatef (ele->rAngle, 0, 0, 1);
					if (snowRotate && ele->type == 2)
						glRotatef (ele->rAngle, 0, 0, 1);
					if (starsRotate && ele->type == 3)
						glRotatef (ele->rAngle, 0, 0, 1);
					if (bubblesRotate && ele->type == 4)
						glRotatef (ele->rAngle, 0, 0, 1);
					glCallList (eScreen->textu[j].dList);
					if (autumnRotate && ele->type == 0)
						glRotatef (-ele->rAngle, 0, 0, 1);
					if (ffRotate && ele->type == 1)
						glRotatef (-ele->rAngle, 0, 0, 1);
					if (snowRotate && ele->type == 2)
						glRotatef (-ele->rAngle, 0, 0, 1);
					if (starsRotate && ele->type == 3)
						glRotatef (-ele->rAngle, 0, 0, 1);
					if (bubblesRotate && ele->type == 4)
						glRotatef (-ele->rAngle, 0, 0, 1);
					glTranslatef (-ele->x, -ele->y, -ele->z);
				}
				ele++;
			}
			disableTexture (eScreen->cScreen, &eScreen->textu[j].tex);
	}
	glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	glDisable (GL_BLEND);
	glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
コード例 #14
0
static void
elementsDisplayOptionChanged (CompDisplay        *d,
			  CompOption         *opt,
			  ElementsDisplayOptions num)
{
	E_DISPLAY (d);
	switch (num)
	{
		case ElementsDisplayOptionToggleAutumnCheck:
		{
			Bool useKeys = FALSE;
			CompScreen *s;
			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				useKeys = eScreen->useKeys;
				if (!useKeys)
				{
					eScreen->isActive[0] = elementsGetToggleAutumnCheck(s->display);
					damageScreen (s);
					eScreen->needUpdate = TRUE;
				}
			}
			if (!useKeys)
				createAll( d );
		}
		break;
		case ElementsDisplayOptionToggleFirefliesCheck:
		{
			Bool useKeys = FALSE;
			CompScreen *s;
			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				useKeys = eScreen->useKeys;
				if (!useKeys)
				{
					eScreen->isActive[1] = elementsGetToggleFirefliesCheck(s->display);
					damageScreen (s);
					eScreen->needUpdate = TRUE;
				}
			}
			if (!useKeys)
				createAll( d );
		}
		break;
		case ElementsDisplayOptionToggleSnowCheck:
		{
			Bool useKeys = FALSE;
			CompScreen *s;
			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				useKeys = eScreen->useKeys;
				if (!useKeys)
				{
					eScreen->isActive[2] = elementsGetToggleSnowCheck(s->display);
					damageScreen (s);
					eScreen->needUpdate = TRUE;
				}
			}
			if (!useKeys)
			createAll( d );
		}
		break;
		case ElementsDisplayOptionToggleStarsCheck:
		{
			Bool useKeys = FALSE;
			CompScreen *s;
			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				useKeys = eScreen->useKeys;
				if (!useKeys)
				{
					eScreen->isActive[3] = elementsGetToggleStarsCheck(s->display);
					damageScreen (s);
					eScreen->needUpdate = TRUE;
				}
			}
			if (!useKeys)
				createAll( d );
		}
		break;
		case ElementsDisplayOptionToggleBubblesCheck:
		{
			Bool useKeys = FALSE;
			CompScreen *s;
			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				useKeys = eScreen->useKeys;
				if (!useKeys)
				{
					eScreen->isActive[4] = elementsGetToggleBubblesCheck(s->display);
					damageScreen (s);
					eScreen->needUpdate = TRUE;
				}
			}
			if (!useKeys)
			createAll( d );
		}
		break;
		case ElementsDisplayOptionToggle:
		{
			CompScreen *s;

			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				eScreen->useKeys = elementsGetToggle(d);
				if (!eScreen->useKeys)
				{
					eScreen->isActive[0] = elementsGetToggleAutumnCheck(s->display);
					eScreen->isActive[1] = elementsGetToggleFirefliesCheck(s->display);
					eScreen->isActive[2] = elementsGetToggleSnowCheck(s->display);
					eScreen->isActive[3] = elementsGetToggleStarsCheck(s->display);
					eScreen->isActive[4] = elementsGetToggleBubblesCheck(s->display);
					createAll( d);
				}
				damageScreen (s);
			}
		}
		break;
		case ElementsDisplayOptionLeafSize:
		{
			CompScreen *s;

			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				eScreen->needUpdate = TRUE;
				updateElementTextures (s, FALSE);
			}
		}
		break;
		case ElementsDisplayOptionBubblesSize:
		{
			CompScreen *s;

			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				eScreen->needUpdate = TRUE;
				updateElementTextures (s, FALSE);
			}
		}

		break;
		case ElementsDisplayOptionSnowSize:
		{
			CompScreen *s;

			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				eScreen->needUpdate = TRUE;
				updateElementTextures (s, FALSE);
			}
		}
		break;
		case ElementsDisplayOptionSnowSway:
		{
			createAll( d );
		}
		break;
		case ElementsDisplayOptionStarsSize:
		{
			CompScreen *s;

			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				eScreen->needUpdate = TRUE;
				updateElementTextures (s, FALSE);
			}
		}
		break;
		case ElementsDisplayOptionFireflySize:
		{
			CompScreen *s;
			for (s = d->screens; s; s = s->next)
			{
				E_SCREEN (s);
				eScreen->needUpdate = TRUE;
				updateElementTextures (s, FALSE);
			}
		}
		break;
		case ElementsDisplayOptionNumLeaves:
		{
			createAll( d );
		}
		break;
		case ElementsDisplayOptionNumBubbles:
		{
			createAll( d );
		}
		break;

		case ElementsDisplayOptionAutumnSway:
		{
			createAll( d );
		}
		break;
		case ElementsDisplayOptionNumFireflies:
		{
			createAll( d );
		}
		break;
		case ElementsDisplayOptionNumSnowflakes:
		{
			createAll( d );
		}
		break;
		case ElementsDisplayOptionNumStars:
		{
			createAll( d );
		}
		break;
		case ElementsDisplayOptionLeafTextures:
		{
			CompScreen *s;
			CompOption *texAutOpt;
			texAutOpt = elementsGetLeafTexturesOption (d);
			ed->texFiles[0] = texAutOpt->value.list.value;
			ed->numTex[0] = texAutOpt->value.list.nValue;
			for (s = d->screens; s; s = s->next)
				updateElementTextures (s, TRUE);
		}
		break;
		case ElementsDisplayOptionBubblesTextures:
		{
			CompScreen *s;
			CompOption *texBubblesOpt;
			texBubblesOpt = elementsGetBubblesTexturesOption (d);
			ed->texFiles[4] = texBubblesOpt->value.list.value;
			ed->numTex[4] = texBubblesOpt->value.list.nValue;
			for (s = d->screens; s; s = s->next)
				updateElementTextures (s, TRUE);
		}
		break;
		case ElementsDisplayOptionFirefliesTextures:
		{
			CompScreen *s;
			CompOption *texFfOpt;

			texFfOpt = elementsGetFirefliesTexturesOption (d);

			ed->texFiles[1] = texFfOpt->value.list.value;
			ed->numTex[1] = texFfOpt->value.list.nValue;

			for (s = d->screens; s; s = s->next)
				updateElementTextures (s, TRUE);
		}
		break;
		case ElementsDisplayOptionSnowTextures:
		{
			CompScreen *s;
			CompOption *texSnowOpt;

			texSnowOpt = elementsGetSnowTexturesOption (d);

			ed->texFiles[2] = texSnowOpt->value.list.value;
			ed->numTex[2] = texSnowOpt->value.list.nValue;

			for (s = d->screens; s; s = s->next)
				updateElementTextures (s, TRUE);
		}
		break;
		case ElementsDisplayOptionStarsTextures:
		{
			CompScreen *s;
			CompOption *texStarsOpt;

			texStarsOpt = elementsGetStarsTexturesOption (d);
			ed->texFiles[3] = texStarsOpt->value.list.value;
			ed->numTex[3] = texStarsOpt->value.list.nValue;

			for (s = d->screens; s; s = s->next)
				updateElementTextures (s, TRUE);

		}
		break;
		default:
		break;
	}
}
コード例 #15
0
static void
createAll( CompDisplay *d )
{
	CompScreen *s;
	int  i, ii, iii, iv ,v, numAutumn, numFf, numSnow, numStars, numBubbles, numTmp;
	element  *ele;

	for (s = d->screens; s; s = s->next)
	{
		E_SCREEN (s);
		if (eScreen->isActive[0])
			numAutumn = elementsGetNumLeaves (s->display);
		else
			numAutumn = 0;
		if (eScreen->isActive[1])
			numFf = elementsGetNumFireflies (s->display);
		else
			numFf = 0;
		if (eScreen->isActive[2])
			numSnow = elementsGetNumSnowflakes (s->display);
		else
			numSnow = 0;
		if (eScreen->isActive[3])
			numStars = elementsGetNumStars (s->display);
		else
			numStars = 0;
		if (eScreen->isActive[4])
			numBubbles = elementsGetNumBubbles (s->display);
		else
			numBubbles = 0;

		numTmp = (numAutumn + numFf + numSnow + numStars + numBubbles);
		eScreen->allElements = ele = realloc (eScreen->allElements,
				 numTmp * sizeof (element));
		ele = eScreen->allElements;

		for (i = 0; i < numAutumn; i++)
		{
			ele->type = 0;
			initiateElement (eScreen, ele);
				setElementTexture (eScreen, ele);
			ele++;
		}
		for (ii = 0; ii < numFf; ii++)
		{
			ele->type = 1;
			initiateElement (eScreen, ele);
			setElementTexture (eScreen, ele);
			ele++;
		}
		for (iii = 0; iii < numSnow; iii++)
		{
			ele->type = 2;
			initiateElement (eScreen, ele);
			setElementTexture (eScreen, ele);
			ele++;
		}
		for (iv = 0; iv < numStars; iv++)
		{
			ele->type = 3;
			initiateElement (eScreen, ele);
			setElementTexture (eScreen, ele);
			ele++;
		}
		for (v = 0; v < numBubbles; v++)
		{
			ele->type = 4;
			initiateElement (eScreen, ele);
			setElementTexture (eScreen, ele);
			ele++;
		}
	}
}