예제 #1
0
static void
greets_display_effect (sync_info *sync, void *params, int iparam)
{
  greets_data *gdata = (greets_data *) params;
  f32 indmtx[2][3] = { { 0.5, 0.0, 0.0 },
		       { 0.0, 0.5, 0.0 } };
  float scroll = (float) sync->time_offset / 900.0;
  int i, startpos;

  /*world_set_pos_lookat_up (gdata->world,
			   (guVector) spooky_ghost_data_0.scene.pos,
			   (guVector) spooky_ghost_data_0.scene.lookat,
			   (guVector) spooky_ghost_data_0.scene.up);*/

  GX_SetIndTexMatrix (GX_ITM_0, indmtx, 5);

  world_display (gdata->world);
  GX_SetZMode (GX_TRUE, GX_LEQUAL, GX_TRUE);
  
  shader_load (gdata->tile_shader);

  startpos = (int) (scroll * 8.0) - 32;

  for (i = 0; i < 4; i++)
    put_text (gdata->tileidx, i, 0, message, sizeof (message) - 1,
	      startpos * 4 + i, 32);

  GX_SetTevColor (GX_TEVREG0, (GXColor) { 255, 255, 255, 255 });
  render_texture (gdata, 5.5, scroll);

  //screenspace_rect (gdata->tile_shader, GX_VTXFMT0, 0);
}
예제 #2
0
inline void Material::ApplyIndStages(void) const
{
	for( int i = 0; i < flags->ind_srt; i++ )
	{
		const IndSrt &ind = ind_srt[i];

		const float rotate_rad = DegToRad(ind.rotate);
		// maybe add a look up table
		float cosF = cosf(rotate_rad);
		float sinF = sinf(rotate_rad);

		int scale_exp = 0;
		f32 mtx23[2][3];
		f32 mtxabs23[2][3];

		mtx23[0][0] = ind.scale_x * cosF;
		mtx23[0][1] = ind.scale_y * -sinF;
		mtx23[0][2] = ind.translate_x;

		mtx23[1][0] = ind.scale_x * sinF;
		mtx23[1][1] = ind.scale_y * cosF;
		mtx23[1][2] = ind.translate_y;

		// create matrix with abs values
		// compiler will optimize the loops
		for(int n = 0; n < 2; n++)
			for(int m = 0; m < 3; m++)
				mtxabs23[n][m] = fabs(mtx23[n][m]);

		// hardcore clamping going on here
		if(		(mtxabs23[0][0] >= 1.0f)
			||	(mtxabs23[0][1] >= 1.0f)
			||	(mtxabs23[0][2] >= 1.0f)
			||	(mtxabs23[1][0] >= 1.0f)
			||	(mtxabs23[1][1] >= 1.0f)
			||	(mtxabs23[1][2] >= 1.0f))
		{
		   	while(	scale_exp < 0x2E
				&& ((mtxabs23[0][0] >= 1.0f)
				||	(mtxabs23[0][1] >= 1.0f)
				||	(mtxabs23[0][2] >= 1.0f)
				||	(mtxabs23[1][0] >= 1.0f)
				||	(mtxabs23[1][1] >= 1.0f)
				||	(mtxabs23[1][2] >= 1.0f)))
		   	{
		   		for(int n = 0; n < 2; n++)
		   		{
					for(int m = 0; m < 3; m++)
					{
						mtx23[n][m] *= 0.5f;
						mtxabs23[n][m] *= 0.5f;
					}
		   		}

		   		scale_exp++;
		   	}
		}
		else if(	(mtxabs23[0][0] < 0.5f)
				&&	(mtxabs23[0][1] < 0.5f)
				&&	(mtxabs23[0][2] < 0.5f)
				&&	(mtxabs23[1][0] < 0.5f)
				&&	(mtxabs23[1][1] < 0.5f)
				&&	(mtxabs23[1][2] < 0.5f))
		{
		   	while(	scale_exp > -0x11
				&&	(mtxabs23[0][0] < 0.5f)
				&&	(mtxabs23[0][1] < 0.5f)
				&&	(mtxabs23[0][2] < 0.5f)
				&&	(mtxabs23[1][0] < 0.5f)
				&&	(mtxabs23[1][1] < 0.5f)
				&&	(mtxabs23[1][2] < 0.5f))
		   	{
		   		for(int n = 0; n < 2; n++)
		   		{
					for(int m = 0; m < 3; m++)
					{
						mtx23[n][m] *= 2.0f;
						mtxabs23[n][m] *= 2.0f;
					}
		   		}

		   		scale_exp--;
		   	}
		}

		GX_SetIndTexMatrix(GX_ITM_0 + i, mtx23, scale_exp);
	}

	for( int i = 0; i < flags->ind_stage; i++ )
	{
		const IndStage &stage = ind_stage[i];
		GX_SetIndTexOrder(i, stage.texcoord, stage.tex_map);
		GX_SetIndTexCoordScale(i, stage.scale_s, stage.scale_t);
	}

	GX_SetNumIndStages(flags->ind_stage);
}
예제 #3
0
static void
ghost_display_effect (sync_info *sync, void *params, int iparam)
{
  glass_data *gdata = (glass_data *) params;
  /*GXTexObj spiderweb_tex_obj;*/
  Mtx mvtmp, rot, mvtmp2;
  Mtx sep_scale;
  f32 indmtx[2][3];

  /* Channels for indirect lookup go:
       R -> -
       G -> U
       B -> T
       A -> S
     We have G/B channels, so map those to S/T.  */

  indmtx[0][0] = 0.0; indmtx[0][1] = 0.5; indmtx[0][2] = 0.0;
  indmtx[1][0] = 0.0; indmtx[1][1] = 0.0; indmtx[1][2] = 0.5;

  GX_SetIndTexMatrix (GX_ITM_0, indmtx, 2);

  GX_SetZMode (GX_FALSE, GX_LEQUAL, GX_FALSE);
  GX_SetBlendMode (GX_BM_NONE, GX_BL_ONE, GX_BL_ONE, GX_LO_SET);
  GX_SetColorUpdate (GX_TRUE);
  GX_SetAlphaUpdate (GX_FALSE);
  GX_SetCullMode (GX_CULL_NONE);

  screenspace_rect (gdata->refraction_postpass_shader, GX_VTXFMT1, 1);
  
  /*GX_LoadTexObj (&spiderweb_tex_obj, GX_TEXMAP1);
  
  draw_square (1, 128 + 127 * sin (thr * M_PI / 360.0),
	       128 + 127 * sin (thr * M_PI / 200.0));*/

  guMtxIdentity (mvtmp);
  guMtxRotAxisDeg (rot, &((guVector) { 0, 1, 0 }), gdata->thr);
  guMtxConcat (rot, mvtmp, mvtmp);
  guMtxRotAxisDeg (rot, &((guVector) { 1, 0, 0 }), gdata->thr * 0.7);
  guMtxConcat (rot, mvtmp, mvtmp);

  /*guMtxScale (sep_scale, 6.0, 6.0, 6.0);*/
  set_sep_scale (sep_scale, sync);
  guMtxTransApply (mvtmp, mvtmp2, gdata->xoffset, 0, 0);
  object_set_matrices (&scene, &gdata->obj_loc, scene.camera, mvtmp2,
		       sep_scale, perspmat, GX_PERSPECTIVE);

  shader_load (gdata->glass_postpass_shader);

  GX_SetBlendMode (GX_BM_BLEND, GX_BL_ONE, GX_BL_SRCALPHA, GX_LO_SET);

  object_set_arrays (&blobby_thing_obj, OBJECT_POS | OBJECT_NORM, GX_VTXFMT0,
		     0);
  object_render (&blobby_thing_obj, OBJECT_POS | OBJECT_NORM, GX_VTXFMT0);

/*
  guMtxTransApply (mvtmp, mvtmp2, 13, 0, 0);
  object_set_matrices (&scene, &gdata->obj_loc, scene.camera, mvtmp2,
		       sep_scale, NULL, 0);
  object_render (&spooky_ghost_obj, OBJECT_POS | OBJECT_NORM, GX_VTXFMT0);

  guMtxTransApply (mvtmp, mvtmp2, -13, 0, 0);
  object_set_matrices (&scene, &gdata->obj_loc, scene.camera, mvtmp2,
		       sep_scale, NULL, 0);
  object_render (&spooky_ghost_obj, OBJECT_POS | OBJECT_NORM, GX_VTXFMT0);
*/

  gdata->thr += 1;
}