Ejemplo n.º 1
0
double		inter_parabo(t_coordonne *vect, t_coordonne *oeil, int rayon)
{
  double	a;
  double	b;
  double	c;
  double	delta;
  double	r;

  r = (double)rayon * (double)M_PI / 180.000;
  a = POW(vect->x) + POW(vect->y);
  b =  2 * ((oeil->x * vect->x) + (oeil->y * vect->y)) - (r * vect->z);
  c = POW(oeil->x) + POW(oeil->y) - (r * oeil->z);
  delta = (b * b) - (4 * (a * c));
  return (search_res(a, b, delta));
}
Ejemplo n.º 2
0
double		inter_paraboloide(t_utils utils, t_objet *obj)
{
  double	a;
  double	b;
  double	c;
  double	R;
  double	d;

  R = obj->size * M_PI / 180;
  a = pow(utils.vect.v_x, 2)			\
    + pow(utils.vect.v_y, 2);
  b = 2 * (utils.coord.x * utils.vect.v_x	\
	   + utils.coord.y * utils.vect.v_y)	\
    - tan(R) * utils.vect.v_z;
  c = pow(utils.coord.x, 2)			\
    + pow(utils.coord.y, 2)			\
    - tan(R) * utils.coord.z;
  d = delta(a, b, c);
  return (search_res(a, b, d));
}
Ejemplo n.º 3
0
double		inter_cone(t_utils utils, t_objet *obj)
{
  double	a;
  double	b;
  double	c;
  double	R;
  double	d;

  R = obj->size * M_PI / 180;
  a = pow(utils.vect.v_x, 2)				\
    + pow(utils.vect.v_y, 2)				\
    - (pow(utils.vect.v_z, 2)				\
       * (pow(tan(R), 2)));
  b = (2 * utils.vect.v_x * utils.coord.x)	\
    + (2 * utils.vect.v_y * utils.coord.y)				\
    - ((2 * utils.vect.v_z * utils.coord.z) * (pow(tan(R), 2)));
  c = (pow(utils.coord.x, 2)						\
       + pow(utils.coord.y, 2)						\
       - (pow(utils.coord.z, 2) * pow(tan(R), 2)));
  d = delta(a, b, c);
  return (search_res(a, b, d));
}
Ejemplo n.º 4
0
int CALLBACK MyDialogFunc(HWND hdwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  static int modi, driver, current_sel_driver;
  int i;
  unsigned int ww;
  static D3DDEVICEINFO *tabella_dev;
  char modo_str[30];
  BOOL err;


  switch (message) {
    case WM_INITDIALOG:

     // enumerazione dei driver directx 8
     driver=Enumerate_DrawDriver(&tabella_dev);
	 if (driver<=0) debug_error(hdwnd, "No DirectX 8 drivers present");
	 for (ww=0; ww<(unsigned int)driver; ww++)
	   SendDlgItemMessage(hdwnd, IDC_COMBO2, CB_ADDSTRING, 0, (LPARAM)tabella_dev[ww].strDesc);

	 SendDlgItemMessage(hdwnd, IDC_COMBO2, CB_SETCURSEL, 0, (LPARAM)0);
	 current_sel_driver=0;
	 for (ww=0; ww<tabella_dev[current_sel_driver].dwNumModes; ww++)
	 {
        sprintf(modo_str, "%dx%dx%d", tabella_dev[0].SupportedModes[ww].Width,
	                                  tabella_dev[0].SupportedModes[ww].Height,
                                      tabella_dev[0].SupportedModes[ww].Bpp);
        SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)modo_str);
	 }
	 // cerco una res 640x480 (prima 32bpp poi 16bpp)
	 i=search_res(tabella_dev, current_sel_driver, 320, 240, 32);
     if (i==-1)
	 {
	   i=search_res(tabella_dev, current_sel_driver, 320, 240, 16);
	   if (i==-1) debug_error(miawin, "This intro need a 320x240 resolution support!");
	   //if (i==-1) SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_SETCURSEL, 0, (LPARAM)0);
	   else SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_SETCURSEL, i, (LPARAM)0);
	 }
	 else SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_SETCURSEL, i, (LPARAM)0);

     // setto fullscreen di default
     SendDlgItemMessage(hdwnd, IDC_RADIO1, BM_SETCHECK, 0, 0);
     SendDlgItemMessage(hdwnd, IDC_RADIO2, BM_SETCHECK, 1, 0);
     SendDlgItemMessage(hdwnd, IDC_CHECK1, BM_SETCHECK, 0, 0);
	 break;


    case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDC_COMBO2:
			   if (HIWORD(wParam)==CBN_CLOSEUP)
			   {
			     i=SendDlgItemMessage(hdwnd, IDC_COMBO2, CB_GETCURSEL, 0, 0L);
				 if (i!=current_sel_driver)
				 {
				   current_sel_driver=i;
                   SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_RESETCONTENT, 0, (LPARAM)0);
	               // enumerazione modi video del nuovo driver
	               for (ww=0; ww<tabella_dev[i].dwNumModes; ww++)
				   { 
	                   sprintf(modo_str, "%dx%dx%d", tabella_dev[i].SupportedModes[ww].Width,
	                                                 tabella_dev[i].SupportedModes[ww].Height,
                                                     tabella_dev[i].SupportedModes[ww].Bpp);
	                   SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)modo_str);
				   }
	               // cerco una res 320x240 (prima 32bpp poi 16bpp)
	               i=search_res(tabella_dev, current_sel_driver, 320, 240, 32);
                   if (i==-1)
				   {
	                 i=search_res(tabella_dev, current_sel_driver, 320, 240, 16);
	                 if (i==-1) debug_error(miawin, "This intro need a 320x240 resolution support!");
	                 //if (i==-1) SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_SETCURSEL, 0, (LPARAM)0);
	                 else SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_SETCURSEL, i, (LPARAM)0);
				   }
	               else SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_SETCURSEL, i, (LPARAM)0);
                   // setto fullscreen di default
                   SendDlgItemMessage(hdwnd, IDC_RADIO1, BM_SETCHECK, 0, 0);
                   SendDlgItemMessage(hdwnd, IDC_RADIO2, BM_SETCHECK, 1, 0);
				 }
			   }
			   break;

		  case IDC_RADIO1:
  			 i=SendDlgItemMessage(hdwnd, IDC_COMBO2, CB_GETCURSEL, 0, 0L);
	         if (!tabella_dev[i].bCanDoWindowed)
			 {
               SendDlgItemMessage(hdwnd, IDC_RADIO1, BM_SETCHECK, 0, 0);
	           SendDlgItemMessage(hdwnd, IDC_RADIO2, BM_SETCHECK, 1, 0);
			 }
			 break;

		  case IDCANCEL:
			   EndDialog(hdwnd, 0);
			   return 1;

		  case IDOK:
			   fpsdiv=30;
			   fpsdiv=GetDlgItemInt(hdwnd, IDC_EDIT2, &err, FALSE);
			   if (fpsdiv==0) fpsdiv=30;
			   RunFullscreen=(BOOL)SendDlgItemMessage(hdwnd, IDC_RADIO2, BM_GETCHECK, 0, 0);
			   NoSound=(BOOL)SendDlgItemMessage(hdwnd, IDC_CHECK1, BM_GETCHECK, 0, 0);
			   i=SendDlgItemMessage(hdwnd, IDC_COMBO1, CB_GETCURSEL, 0, 0L);
			   driver_to_use=tabella_dev[current_sel_driver];
			   driver_to_use.WantedMode=tabella_dev[current_sel_driver].SupportedModes[i];
			   if ((driver_to_use.WantedMode.Width == 320) ||
                   (driver_to_use.WantedMode.Height == 240))
			   {
			      driver_to_use.bFullscreen=RunFullscreen;
			      EndDialog(hdwnd, 1);
			      return 1;
			   }
			   else MessageBox(hdwnd, "You MUST select a 320x240 resolution", "AD-Debug", NULL); 
		}
  }
  return(0);
}