コード例 #1
0
ファイル: duck_fountain.c プロジェクト: crtc-demos/wobble
void
display_fountain (uint32_t time_offset, void *params, int iparam,
		  viewpoint *view, lighting *lights, int pass)
{
  int i;
  
  if (pass != PVR_LIST_OP_POLY)
    return;

  lights->active = 1;
  
  for (i = 0; i < active; i++)
    {
      if (duck_colour[i])
	{
	  object_set_ambient (duck, 64, 64, 0);
	  object_set_pigment (duck, 255, 255, 0);
	}
      else
	{
	  object_set_ambient (duck, 64, 32, 64);
	  object_set_pigment (duck, 255, 127, 255);
	}

      glPushMatrix ();
      glTranslatef (pos[i][0], pos[i][1], pos[i][2]);
      glRotatef (rot1, rotaxis[i][0], rotaxis[i][1], rotaxis[i][2]);
      glScalef (0.3, 0.3, 0.3);
      glGetFloatv (GL_MODELVIEW_MATRIX, &mview[0][0]);
      
      /* Mmmm, very generalised.  */
      if (pos[i][2] > 12)
        object_set_clipping (duck, 1);
      else
        object_set_clipping (duck, 0);
      
      vec_normal_from_modelview (&normxform[0][0], &mview[0][0]);
      object_render_immediate (view, duck, &obj_orient, lights, pass);
      glPopMatrix ();
    }

  glPushMatrix ();
  glTranslatef (0, -2, -4);  /* The spawn position.  */
  glScalef (2, 2, 2);
  glGetFloatv (GL_MODELVIEW_MATRIX, &mview[0][0]);
  vec_normal_from_modelview (&normxform[0][0], &mview[0][0]);
  object_render_immediate (view, shooter, &obj_orient, lights, pass);
  glPopMatrix ();
}
コード例 #2
0
ファイル: script_obj_setting.c プロジェクト: rzel/dim3
JSValueRef js_obj_set_ambient_func(JSContextRef cx,JSObjectRef func,JSObjectRef j_obj,size_t argc,const JSValueRef argv[],JSValueRef *exception)
{
	char			name[name_str_len];
	obj_type		*obj;
	
	if (!script_check_param_count(cx,func,argc,2,exception)) return(script_null_to_value(cx));
	
	obj=object_get_attach(j_obj);
	
	script_value_to_string(cx,argv[0],name,name_str_len);
	object_set_ambient(obj,name,script_value_to_float(cx,argv[1]));

	return(script_null_to_value(cx));
}
コード例 #3
0
ファイル: duck_fountain.c プロジェクト: crtc-demos/wobble
static void
preinit_effect (void)
{
  static int initialised = 0;
  
  if (initialised)
    return;

  duck = load_object ("/rd/duck_hi.strips");

  object_set_ambient (duck, 64, 0, 0);
  object_set_pigment (duck, 255, 0, 0);
  object_set_clipping (duck, 0);
  
  shooter = load_object ("/rd/duck_shooter.strips");
    
  initialised = 1;
}