Example #1
0
#include "CVL.hpp"

const color_t g_GOPcolors[256] = {
  COLOR_RGB(72, 231, 36),
  COLOR_RGB(69, 233, 38),
  COLOR_RGB(66, 234, 41),
  COLOR_RGB(63, 236, 43),
  COLOR_RGB(60, 238, 46),
  COLOR_RGB(57, 239, 49),
  COLOR_RGB(54, 241, 52),
  COLOR_RGB(52, 243, 55),
  COLOR_RGB(50, 244, 59),
  COLOR_RGB(47, 245, 62),
  COLOR_RGB(45, 247, 65),
  COLOR_RGB(43, 248, 69),
  COLOR_RGB(42, 249, 73),
  COLOR_RGB(40, 250, 76),
  COLOR_RGB(38, 251, 80),
  COLOR_RGB(37, 252, 84),
  COLOR_RGB(36, 253, 88),
  COLOR_RGB(35, 254, 92),
  COLOR_RGB(34, 254, 96),
  COLOR_RGB(34, 254, 101),
  COLOR_RGB(33, 255, 105),
  COLOR_RGB(33, 255, 110),
  COLOR_RGB(33, 255, 114),
  COLOR_RGB(33, 255, 119),
  COLOR_RGB(33, 255, 123),
  COLOR_RGB(34, 254, 128),
  COLOR_RGB(34, 254, 133),
  COLOR_RGB(35, 253, 137),
Example #2
0
//QUAKED misc_particles (.6 .7 .7) (-8 -8 -8) (8 8 8) SPHERICAL SOLID GRAVITY LIGHT EXPAND_EFFECT SHRINK_EFFECT START_OFF
//-------- KEYS --------
//angles: direction in which particles will be thrown.
//shader : particleShader
void SP_misc_particles( edict_t *ent )
{
	ent->r.svflags &= ~SVF_NOCLIENT;
	ent->r.svflags |= SVF_BROADCAST;
	ent->r.solid = SOLID_NOT;
	ent->s.type = ET_PARTICLES;

	if( st.noise )
	{
		ent->s.sound = trap_SoundIndex( st.noise );
		G_PureSound( st.noise );
	}

	if( st.gameteam >= TEAM_ALPHA && st.gameteam < GS_MAX_TEAMS )
		ent->s.team = st.gameteam;
	else
		ent->s.team = 0;

	if( ent->speed > 0 )
		ent->particlesInfo.speed = ((int)ent->speed) & 255;

	if( ent->count > 0 )
		ent->particlesInfo.frequency = ent->count & 255;

	if( st.shaderName )
		ent->particlesInfo.shaderIndex = trap_ImageIndex( st.shaderName );
	else
		ent->particlesInfo.shaderIndex = trap_ImageIndex( "particle" );

	if( st.size )
		ent->particlesInfo.size = st.size & 255;
	else
		ent->particlesInfo.size = 16;

	ent->particlesInfo.time = ent->delay;
	if( !ent->particlesInfo.time )
		ent->particlesInfo.time = 4;

	if( ent->spawnflags & 1 ) // SPHERICAL
		ent->particlesInfo.spherical = true;

	if( ent->spawnflags & 2 ) // BOUNCE
		ent->particlesInfo.bounce = true;

	if( ent->spawnflags & 4 ) // GRAVITY
		ent->particlesInfo.gravity = true;

	if( ent->spawnflags & 8 ) // LIGHT
	{
		ent->s.light = COLOR_RGB( (qbyte)(ent->color[0] * 255), (qbyte)(ent->color[1] * 255), (qbyte)(ent->color[2] * 255) );
		if( !ent->s.light )
			ent->s.light = COLOR_RGB( 255, 255, 255 );
	}

	if( ent->spawnflags & 16 ) // EXPAND_EFFECT
		ent->particlesInfo.expandEffect = true;

	if( ent->spawnflags & 32 ) // SHRINK_EFFECT
		ent->particlesInfo.shrinkEffect = true;

	if( ent->spawnflags & 64 ) // START_OFF
		ent->r.svflags |= SVF_NOCLIENT;

	if( st.radius > 0 )
	{
		ent->particlesInfo.spread = st.radius;
		clamp( ent->particlesInfo.spread, 0, 255 );
	}

	ent->think = SP_misc_particles_finish;
	ent->nextThink = level.time + 1;
	ent->use = SP_misc_particles_use;

	GClip_LinkEntity( ent );
}
Example #3
0
int main() {
  uint32_t i, j = 0;
  uint16_t r, g, b;
  FILE *pArchSprNumeros;
  FILE *pArchSprBorradoHr;
  FILE *pArchSprBorradoVr;
  FILE *pArchSprNumerosZ1;
  FILE *pArchSprNumerosZ2;

  pArchSprNumeros = fopen("../arduino/dosala-N/sprites/spr_numeros.h", "w");
  for (i=0; i<nPixelSprNumeros; i+=3) {
    if (j==0)
      fprintf(pArchSprNumeros, "  ");

    r = SPR_NUMEROS_PIXEL_DATA[i+0] >> 3;
    g = SPR_NUMEROS_PIXEL_DATA[i+1] >> 2;
    b = SPR_NUMEROS_PIXEL_DATA[i+2] >> 3;

    fprintf(pArchSprNumeros, "0x%04x, ", COLOR_RGB(r, g, b));

    if (j==anchoFilaTxtSprNumeros-1)
      fprintf(pArchSprNumeros, "\n");

    j = (j+1) % anchoFilaTxtSprNumeros;
  }
  fclose(pArchSprNumeros);

  pArchSprBorradoHr = fopen("../arduino/dosala-N/sprites/spr_borrado_hr.h", "w");
  for (i=0; i<nPixelSprBorradoHr; i+=3) {
    if (j==0)
      fprintf(pArchSprBorradoHr, "  ");

    r = SPR_BORRADO_HR_PIXEL_DATA[i+0] >> 3;
    g = SPR_BORRADO_HR_PIXEL_DATA[i+1] >> 2;
    b = SPR_BORRADO_HR_PIXEL_DATA[i+2] >> 3;

    fprintf(pArchSprBorradoHr, "0x%04x, ", COLOR_RGB(r, g, b));

    if (j==anchoFilaTxtSprBorradoHr-1)
      fprintf(pArchSprBorradoHr, "\n");

    j = (j+1) % anchoFilaTxtSprBorradoHr;
  }
  fclose(pArchSprBorradoHr);

  pArchSprBorradoVr = fopen("../arduino/dosala-N/sprites/spr_borrado_vr.h", "w");
  for (i=0; i<nPixelSprBorradoVr; i+=3) {
    if (j==0)
      fprintf(pArchSprBorradoVr, "  ");

    r = SPR_BORRADO_VR_PIXEL_DATA[i+0] >> 3;
    g = SPR_BORRADO_VR_PIXEL_DATA[i+1] >> 2;
    b = SPR_BORRADO_VR_PIXEL_DATA[i+2] >> 3;

    fprintf(pArchSprBorradoVr, "0x%04x, ", COLOR_RGB(r, g, b));

    if (j==anchoFilaTxtSprBorradoVr-1)
      fprintf(pArchSprBorradoVr, "\n");

    j = (j+1) % anchoFilaTxtSprBorradoVr;
  }
  fclose(pArchSprBorradoVr);

  pArchSprNumerosZ1 = fopen("../arduino/dosala-N/sprites/spr_numeros_z1.h", "w");
  for (i=0; i<nPixelSprNumerosZ1; i+=3) {
    if (j==0)
      fprintf(pArchSprNumerosZ1, "  ");

    r = SPR_NUMEROS_Z1_PIXEL_DATA[i+0] >> 3;
    g = SPR_NUMEROS_Z1_PIXEL_DATA[i+1] >> 2;
    b = SPR_NUMEROS_Z1_PIXEL_DATA[i+2] >> 3;

    fprintf(pArchSprNumerosZ1, "0x%04x, ", COLOR_RGB(r, g, b));

    if (j==anchoFilaTxtSprNumerosZ1-1)
      fprintf(pArchSprNumerosZ1, "\n");

    j = (j+1) % anchoFilaTxtSprNumerosZ1;
  }
  fclose(pArchSprNumerosZ1);

  pArchSprNumerosZ2 = fopen("../arduino/dosala-N/sprites/spr_numeros_z2.h", "w");
  for (i=0; i<nPixelSprNumerosZ2; i+=3) {
    if (j==0)
      fprintf(pArchSprNumerosZ2, "  ");

    r = SPR_NUMEROS_Z2_PIXEL_DATA[i+0] >> 3;
    g = SPR_NUMEROS_Z2_PIXEL_DATA[i+1] >> 2;
    b = SPR_NUMEROS_Z2_PIXEL_DATA[i+2] >> 3;

    fprintf(pArchSprNumerosZ2, "0x%04x, ", COLOR_RGB(r, g, b));

    if (j==anchoFilaTxtSprNumerosZ2-1)
      fprintf(pArchSprNumerosZ2, "\n");

    j = (j+1) % anchoFilaTxtSprNumerosZ2;
  }
  fclose(pArchSprNumerosZ2);

  return 0;
}
Example #4
0
void mainScreen(void){
	uint32 ReadWord;
	int16 xvalue,yvalue;
	ft_char8_t StringArray[100];

		Ft_Gpu_CoCmd_Dlstart(phost);
		Ft_App_WrCoCmd_Buffer(phost,CLEAR_COLOR_RGB(64,64,64));
		Ft_App_WrCoCmd_Buffer(phost,CLEAR(1,1,1));
		Ft_App_WrCoCmd_Buffer(phost,COLOR_RGB(255,255,255));

		Ft_Gpu_CoCmd_Button(phost, 10, 200, 130, 30, 28, 0, "Smart Mirror");
		if(!saved){
			Ft_Gpu_CoCmd_Button(phost, 200, 200, 110, 30, 28, 0, "Save data");
		} else{
			Ft_Gpu_CoCmd_Button(phost, 200, 200, 110, 30, 28, 0, "Saved");
		}

		StringArray[0] = '\0';
		strcat(StringArray,"Outside: ");
		Ft_Gpu_Hal_Dec2Ascii(StringArray,(ft_int32_t)tempOut);
		strcat(StringArray," C");
		Ft_Gpu_CoCmd_Text(phost, 10, 20, 26, 0, StringArray);
		
		StringArray[0] = '\0';
		strcat(StringArray,"Inside: ");
		Ft_Gpu_Hal_Dec2Ascii(StringArray,(ft_int32_t)tempIn);
		strcat(StringArray," C");
		Ft_Gpu_CoCmd_Text(phost, 10, 40, 26, 0, StringArray);
		
		StringArray[0] = '\0';
		strcat(StringArray,"Engine: ");
		Ft_Gpu_Hal_Dec2Ascii(StringArray,(ft_int32_t)tempEngine);
		strcat(StringArray," C");
		Ft_Gpu_CoCmd_Text(phost, 10, 60, 26, 0, StringArray);

		StringArray[0] = '\0';
		strcat(StringArray,"GPS: ");
		Ft_Gpu_CoCmd_Text(phost, 220, 20, 26, 0, StringArray);

		ReadWord = Ft_Gpu_Hal_Rd32(phost, REG_TOUCH_DIRECT_XY);
		yvalue = (int16)(ReadWord & 0xffff);
		xvalue = (int16)((ReadWord>>16) & 0xffff);

		if(xvalue > 70 && xvalue < 460 && yvalue > 70 && yvalue < 190){
			printf("Smart mirror \n");
			screenNR = 2;
		} else if(xvalue > 630 && xvalue < 950 && yvalue > 70 && yvalue < 190){
			saved = !saved;
			printf("Save Data = %i\n", saved);
		} else
			printf("x = %i y = %i\n", xvalue, yvalue);

		Ft_App_WrCoCmd_Buffer(phost,DISPLAY());
		Ft_Gpu_CoCmd_Swap(phost);

		/* Download the commands into fifo */
		Ft_App_Flush_Co_Buffer(phost);

		/* Wait till coprocessor completes the operation */
		Ft_Gpu_Hal_WaitCmdfifo_empty(phost);
		Ft_Gpu_Hal_Sleep(30);
}
Example #5
0
File: main.c Project: 2bt/raytracer
unsigned int trace(const vec p, const vec d) {
	static const vec light = { 0.408248, 0.816497, -0.408248 };
	vec o;
	int i;
	float t = 0, a = 0;
	for (i = 0; i < 75; i++) {

		mov(o, d);
		mul(o, t);
		add(o, p);

		if (f(o) < 0) break;
		a = t;
		t += 0.125;
	}
	if (i == 75) return 0x000000;

	float b = t;
	for (i = 0; i < 10; i++) {
		t = (a + b) * 0.5;

		mov(o, d);
		mul(o, t);
		add(o, p);

		if (f(o) < 0) b = t;
		else a = t;
	}

	mov(o, d);
	mul(o, t);
	add(o, p);

	vec o2, o3;
	mov(o2, o);
	mov(o3, o);
	o[0] += 0.1;
	o2[1] += 0.1;
	o3[2] += 0.1;
	vec n = { f(o), f(o2), f(o2) };
	normalize(n);
	float diffuse = -dot(n, light);
	if (diffuse < 0) diffuse = 0;

	mul(n, dot(d, n) * -2);
	add(n, d);
	float specular = dot(n, light);
	if (specular < 0) specular = 0;
	specular = pow(specular, 60);

	float fog = 1 - t / 11;
	fog *= fog;

	float pattern = (
		(fmod(o[0], 0.2) < 0.1) +
		(fmod(o[1], 0.2) < 0.1) +
		(fmod(o[2], 0.2) < 0.1)) * 50;

	return COLOR_RGB(
		(255 * diffuse + specular * 200) * fog,
		(pattern * diffuse + specular * 200) * fog,
		(130 * diffuse + specular * 200) * fog);
}