Пример #1
0
static void
glw_mirror_render(glw_t *w, const glw_rctx_t *rc)
{
  glw_t *c;
  glw_rctx_t rc0;
  int b;

  if((c = TAILQ_FIRST(&w->glw_childs)) == NULL)
    return;

  b = glw_clip_enable(w->glw_root, rc, GLW_CLIP_BOTTOM, 0);
  glw_render0(c, rc);
  glw_clip_disable(w->glw_root, b);

  rc0 = *rc;

  glw_Translatef(&rc0, 0, -1, 0);
  glw_Scalef(&rc0, 1.0, -1.0, 1.0);
  glw_Translatef(&rc0, 0, 1, 0);

  glw_frontface(w->glw_root, GLW_CW);

  rc0.rc_alpha *= w->glw_alpha;
  rc0.rc_inhibit_matrix_store = 1;

  b = glw_clip_enable(w->glw_root, &rc0, GLW_CLIP_BOTTOM, 0);
  glw_render0(c, &rc0);
  glw_clip_disable(w->glw_root, b);

  glw_frontface(w->glw_root, GLW_CCW);
}
Пример #2
0
static void
glw_freefloat_render(glw_t *w, const glw_rctx_t *rc)
{
  glw_freefloat_t *ff = (glw_freefloat_t *)w;
  glw_t *c;
  int i;
  float a;
  glw_rctx_t rc0;

  for(i = 0; i < ff->num_visible; i++) {
    if((c = ff->visible[i]) == NULL)
      continue;

    rc0 = *rc;
    a = (1 - fabs(-1 + (GLW_MAX(0, -0.1 + c->glw_parent_v * 2.1))));

    rc0.rc_alpha *= a;

    glw_Translatef(&rc0, 
		   c->glw_parent_x,
		   c->glw_parent_y,
		   -5 + c->glw_parent_v * 5);

    glw_Rotatef(&rc0, 
		-30 + c->glw_parent_v * 60,
		fabsf(sin(c->glw_parent_a)),
		fabsf(cos(c->glw_parent_a)),
		0.0);

    glw_render0(c, &rc0);
  }
}
Пример #3
0
static void
glw_displacement_render(glw_t *w, const glw_rctx_t *rc)
{
  glw_displacement_t *gd = (glw_displacement_t *)w;
  glw_t *c;
  glw_rctx_t rc0 = *rc;

  rc0.rc_alpha = rc->rc_alpha * w->glw_alpha;
  if(rc0.rc_alpha < 0.01)
    return;

  if((c = TAILQ_FIRST(&w->glw_childs)) == NULL)
    return;
   
  glw_Translatef(&rc0,
		 gd->gd_translate_x,
		 gd->gd_translate_y,
		 gd->gd_translate_z);

  glw_Scalef(&rc0, 
	     gd->gd_scale_x,
	     gd->gd_scale_y,
	     gd->gd_scale_z);

  if(gd->gd_rotate_a)
    glw_Rotatef(&rc0, 
		gd->gd_rotate_a,
		gd->gd_rotate_x,
		gd->gd_rotate_y,
		gd->gd_rotate_z);

  glw_repositionf(&rc0,
		  gd->gd_padding_left,
		  rc->rc_height - gd->gd_padding_top,
		  rc->rc_width  - gd->gd_padding_right,
		  gd->gd_padding_bottom);

  if(glw_is_focusable(w))
    glw_store_matrix(w, &rc0);

  glw_render0(c, &rc0);
}
Пример #4
0
static void
glw_fx_texrot_render_internal(glw_root_t *gr, glw_rctx_t *rc,
			      glw_fx_texrot_t *fx, glw_loadable_texture_t *glt)
{
  int i;
  glw_rctx_t rc0;

  glw_blendmode(gr, GLW_BLEND_ADDITIVE);

  glw_Scalef(rc, 2.0, 2.0, 1.0);

  for(i = 0; i < FX_NPLATES; i++) {

    rc0 = *rc;
    fx->fx_plates[i].angle += fx->fx_plates[i].inc;

    glw_Translatef(&rc0, fx->fx_plates[i].x, fx->fx_plates[i].y, 0.0);
    glw_Rotatef(&rc0, fx->fx_plates[i].angle, 0.0, 0.0, 1.0);

    glw_renderer_draw(&fx->fx_source_render, gr, &rc0,
		      &glt->glt_texture, NULL, NULL, 0.15);
  }
  glw_blendmode(gr, GLW_BLEND_NORMAL);
}
Пример #5
0
static void 
glw_image_render(glw_t *w, const glw_rctx_t *rc)
{
  glw_image_t *gi = (void *)w;
  const glw_loadable_texture_t *glt = gi->gi_current;
  float alpha_self;
  float blur = 1 - (rc->rc_sharpness * w->glw_sharpness);
  glw_rctx_t rc0;
  
  alpha_self = rc->rc_alpha * w->glw_alpha * gi->gi_alpha_self * gi->gi_autofade;

  if(gi->gi_mode == GI_MODE_NORMAL || gi->gi_mode == GI_MODE_ALPHA_EDGES) {

    if(glt == NULL || !glw_is_tex_inited(&glt->glt_texture))
      return;

    rc0 = *rc;

    glw_align_1(&rc0, w->glw_alignment);
      
    if(gi->gi_bitmap_flags & GLW_IMAGE_FIXED_SIZE)
      glw_scale_to_pixels(&rc0, glt->glt_xs, glt->glt_ys);
    else if(w->glw_class == &glw_image || w->glw_class == &glw_icon)
      glw_scale_to_aspect(&rc0, glt->glt_aspect);

    if(gi->gi_angle != 0)
      glw_Rotatef(&rc0, -gi->gi_angle, 0, 0, 1);

    glw_align_2(&rc0, w->glw_alignment);

    if(glw_is_focusable(w))
      glw_store_matrix(w, &rc0);

    if(w->glw_class == &glw_frontdrop)
      render_child_simple(w, &rc0);

    if(alpha_self > 0.01f) {

      if(w->glw_flags2 & GLW2_SHADOW && !rc0.rc_inhibit_shadows) {
	float xd =  6.0f / rc0.rc_width;
	float yd = -6.0f / rc0.rc_height;

	glw_Translatef(&rc0, xd, yd, 0.0f);
	
	static const glw_rgb_t black = {0,0,0};

	glw_renderer_draw(&gi->gi_gr, w->glw_root, &rc0,
			  &glt->glt_texture,
			  &black, NULL, alpha_self * 0.75f, 1);
	glw_Translatef(&rc0, -xd, -yd, 0.0f);
      }

      if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE)
	glw_blendmode(w->glw_root, GLW_BLEND_ADDITIVE);

      glw_renderer_draw(&gi->gi_gr, w->glw_root, &rc0,
			&glt->glt_texture,
			&gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur);

      if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE)
	glw_blendmode(w->glw_root, GLW_BLEND_NORMAL);
    }

    if(w->glw_class != &glw_frontdrop)
      render_child_simple(w, &rc0);

  } else {

    if(glw_is_focusable(w))
      glw_store_matrix(w, rc);

    if(w->glw_class == &glw_frontdrop)
      render_child_autocentered(gi, rc);

    if(glt && glw_is_tex_inited(&glt->glt_texture) && alpha_self > 0.01f) {

      if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE)
	glw_blendmode(w->glw_root, GLW_BLEND_ADDITIVE);

      glw_renderer_draw(&gi->gi_gr, w->glw_root, rc,
			&glt->glt_texture,
			&gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur);

      if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE)
	glw_blendmode(w->glw_root, GLW_BLEND_NORMAL);
    }
    if(w->glw_class != &glw_frontdrop)
      render_child_autocentered(gi, rc);
  }
}