예제 #1
0
void
R_InitParticleTexture(void)
{
	int x, y;
	byte data[8][8][4];

	/* particle texture */
	for (x = 0; x < 8; x++)
	{
		for (y = 0; y < 8; y++)
		{
			data[y][x][0] = 255;
			data[y][x][1] = 255;
			data[y][x][2] = 255;
			data[y][x][3] = dottexture[x][y] * 255;
		}
	}

	r_particletexture = R_LoadPic("***particle***", (byte *)data,
			8, 0, 8, 0, it_sprite, 32);

	/* also use this for bad textures, but without alpha */
	for (x = 0; x < 8; x++)
	{
		for (y = 0; y < 8; y++)
		{
			data[y][x][0] = dottexture[x & 3][y & 3] * 255;
			data[y][x][1] = 0;
			data[y][x][2] = 0;
			data[y][x][3] = 255;
		}
	}

	r_notexture = R_LoadPic("***r_notexture***", (byte *)data,
			8, 0, 8, 0, it_wall, 32);
}
예제 #2
0
/*
 * =================
 * R_Bloom_InitBackUpTexture
 * =================
 */
void R_Bloom_InitBackUpTexture(int width, int height)
{
    byte *data;

    data = malloc(width * height * 4);
    memset(data, 0, width * height * 4);

//	r_screenbackuptexture_size = width;
    r_screenbackuptexture_width  = width;
    r_screenbackuptexture_height = height;

    r_bloombackuptexture = R_LoadPic("***r_bloombackuptexture***", (byte *)data, width, height, it_pic, 3);

    free(data);
}
예제 #3
0
/*
 * =================
 * R_Bloom_InitEffectTexture
 * =================
 */
void R_Bloom_InitEffectTexture(void)
{
    byte  *data;
    float bloomsizecheck;

    if ((int)r_bloom_sample_size->value < 32)
    {
        Cvar_SetValue("r_bloom_sample_size", 32);
    }

    //make sure bloom size is a power of 2
    BLOOM_SIZE     = (int)r_bloom_sample_size->value;
    bloomsizecheck = (float)BLOOM_SIZE;
    while (bloomsizecheck > 1.0f)
    {
        bloomsizecheck /= 2.0f;
    }
    if (bloomsizecheck != 1.0f)
    {
        BLOOM_SIZE = 32;
        while (BLOOM_SIZE < (int)r_bloom_sample_size->value)
        {
            BLOOM_SIZE *= 2;
        }
    }

    //make sure bloom size doesn't have stupid values
    if ((BLOOM_SIZE > screen_texture_width) ||
        (BLOOM_SIZE > screen_texture_height))
    {
        BLOOM_SIZE = min(screen_texture_width, screen_texture_height);
    }

    if (BLOOM_SIZE != (int)r_bloom_sample_size->value)
    {
        Cvar_SetValue("r_bloom_sample_size", BLOOM_SIZE);
    }

    data = malloc(BLOOM_SIZE * BLOOM_SIZE * 4);
    memset(data, 0, BLOOM_SIZE * BLOOM_SIZE * 4);

    r_bloomeffecttexture = R_LoadPic("***r_bloomeffecttexture***", (byte *)data, BLOOM_SIZE, BLOOM_SIZE, it_pic, 3);

    free(data);
}