示例#1
0
int MaterialMixer::Interface (int version, LWInterface *local, void *serverdata)
{
	static LWXPanelControl ctrl[] =
	{
		{MDiff, "Diffuse Mode", "iPopChoice"},
		{BDiff, "Diffuse Opacity", "percent-env"},
		{MSpec, "Specular Mode", "iPopChoice"},
		{BSpec, "Specular Opacity", "percent-env"},
		{MRefl, "Reflection Mode", "iPopChoice"},
		{BRefl, "Reflection Opacity", "percent-env"},
		{MRefr, "Refraction Mode", "iPopChoice"},
		{BRefr, "Refraction Opacity", "percent-env"},
		{MTran, "Transparency Mode", "iPopChoice"},
		{BTran, "Transparency Opacity", "percent-env"},
		0
	};
	static LWXPanelDataDesc desc[] =
	{
		{MDiff, "Diffuse Mode", "integer"},
		{BDiff, "Diffuse Opacity", "float-env"},
		{MSpec, "Specular Mode", "integer"},
		{BSpec, "Specular Opacity", "float-env"},
		{MRefl, "Reflection Mode", "integer"},
		{BRefl, "Reflection Opacity", "float-env"},
		{MRefr, "Refraction Mode", "integer"},
		{BRefr, "Refraction Opacity", "float-env"},
		{MTran, "Transparency Mode", "integer"},
		{BTran, "Transparency Opacity", "float-env"},
	};

	static LWXPanelHint hints[] =
	{
		XpSTRLIST(MDiff, blendModeS),
		XpSTRLIST(MSpec, blendModeS),
		XpSTRLIST(MRefl, blendModeS),
		XpSTRLIST(MRefr, blendModeS),
		XpSTRLIST(MTran, blendModeS),
		XpDIVADD(BDiff),
		XpDIVADD(BSpec),
		XpDIVADD(BRefl),
		XpDIVADD(BRefr),
		XpEND,
	};

	CreateViewXPanel (ctrl, desc, hints);
	local->panel = LW_XPanel.getID();
	return AFUNC_OK;
}
示例#2
0
文件: atmosphere.cpp 项目: dbw/lwpp
/*
======================================================================
Interface()

XPanels Interface.  Called when the user presses the "Options"
button.
====================================================================== */
int Atmosphere::Interface( int version, LWInterface *local, void *serverData )
{
	UNUSED(serverData);
	UNUSED(version);

	if ( !txedf ) return AFUNC_BADGLOBAL;
	
	LWXPanelHint hint[] = {
		XpLABEL( 0, "VFog Settings" ),
		XpBUTNOTIFY( ID_TXBT, XPanelInterface::LWXPanelBtnClickFunc ),
		XpSTRLIST( ID_RES, quality ),
		XpSTRLIST( ID_MARCH, render ),

		XpGROUP_( ID_GGRP ),
			XpH( ID_HI ), XpH( ID_LO ), XpH( ID_FA ), XpH( ID_DEN ), XpEND,
		XpGROUP_( ID_SGRP ),
			XpH( ID_LUM ), XpH( ID_OPA ), XpH( ID_BCK ), XpH( ID_COL ), XpEND,
		XpGROUP_( ID_RGRP ),
			XpH( ID_RES ), XpH( ID_TXTR ), XpH( ID_TXBT ), XpEND,

		XpENABLE_( ID_MARCH ),
			XpH( ID_RGRP ), XpEND,
		XpENABLE_MAP_( ID_BCK, bckMap ),
			XpH( ID_COL ), XpEND,

		XpMIN( ID_LUM, 0 ), XpMAX( ID_LUM, 1 ),
		XpMIN( ID_OPA, 0 ), XpMAX( ID_OPA, 1 ),
		XpMIN( ID_FA, 0 ),  XpMAX( ID_FA, 1 ),

		XpEND
	}; // end hint[]
		
	CreateViewXPanel (ctrl_list, data_descrip, hint);

	// FINE because the callback it is in our class
	LW_XPanel.setUserData(this, ID_TXBT);

	local->panel = LW_XPanel.getID();

	local->options = NULL;
	local->command = NULL;

	return AFUNC_OK;
}
示例#3
0
/*
 * NonModal VIEW Panel Interface
 *
 * NonModal interfaces are created on activation.
 */
int
DentedInterface (long version, GlobalFunc *global, LWInterface *iface,
  void *serverdata )
{
  int			 rc = AFUNC_OK;
  LWXPanelID     panID = NULL;
  Dented		*inst = NULL;

  // These are the control lists and configuration hints
  static LWXPanelControl DT_ctrl_list[] = {
   { OPTS_SCALE,         "Scale",          "float-env" },
   { OPTS_POWER,         "Power",          "float-env" },
   { OPTS_FREQUENCY,     "Frequency",      "float-env" },
   { OPTS_OCTAVES,       "Octaves",        "float-env" },
   { OPTS_FNOISE,        "Noise Type",     "iPopChoice" },
   {0}
  };

  static LWXPanelDataDesc DT_data_descrip[] = {
   { OPTS_SCALE,         "Scale",          "float-env" },
   { OPTS_POWER,         "Power",          "float-env" },
   { OPTS_FREQUENCY,     "Frequency",      "float-env" },
   { OPTS_OCTAVES,       "Octaves",        "float-env" },
   { OPTS_FNOISE,        "Noise Type",     "integer" },
   {0}
  };

  static LWXPanelHint DT_hint[] = {
    XpSTRLIST(OPTS_FNOISE, FNoise),
    XpRANGE(OPTS_SCALE, -10, 10, 1),
    XpRANGE(OPTS_POWER, -5, 5, 1),
    XpRANGE(OPTS_FREQUENCY, -5, 5, 1),
    XpRANGE(OPTS_OCTAVES, 0, 10, 1),
    XpH(OPTS_SCALE), XpEND,
    XpH(OPTS_POWER), XpEND,
    XpH(OPTS_FREQUENCY), XpEND,
    XpH(OPTS_OCTAVES), XpEND,
    XpH(OPTS_FNOISE), XpEND,
    XpLABEL(0,"Dented"),
    XpDESTROYNOTIFY(DT_view_destroy),
    XpEND
  };

  // Check the version
  // NOTE: The interface version is different from handler version
  if ( version != LWINTERFACE_VERSION )
    return (AFUNC_BADVERSION);

  xpfunc = global(LWXPANELFUNCS_GLOBAL, GFUSE_TRANSIENT);

  if ( !xpfunc )
    return AFUNC_BADGLOBAL;

  inst = (Dented *) iface->inst;

  // If we already have an XPanel which has not been destroyed,
  // we can destroy it and create another, or return the existing instance.
  
    // Create panel
    panID = (*xpfunc->create)( LWXP_VIEW, DT_ctrl_list );
    if (panID) {

      // Apply some hints
      (*xpfunc->hint) ( panID, 0, DT_hint );

      // Describe the structure of the data instance to the panel
      (*xpfunc->describe)( panID, DT_data_descrip, DT_view_get, DT_view_set );

      // Now give the data instance to the panel
      (*xpfunc->viewInst)( panID, inst );

      // Set the userdata
      (*xpfunc->setData)(panID, 0, inst);
  	}

    // Set the interface panel pointer
    iface->panel = panID;

  // Return and let LightWave play with the panel :)
  return rc;
}
示例#4
0
文件: ui.c 项目: DimondTheCat/xray
int get_user( LWXPanelFuncs *xpanf, double *size, double *center,
   char *surfname, char *vmapname )
{
   LWXPanelID panel;
   int ok = 0;

   enum { ID_SIZE = 0x8001, ID_CENTER, ID_SURFLIST, ID_VMAPNAME };
   LWXPanelControl ctl[] = {
      { ID_SIZE,     "Size",      "distance3"  },
      { ID_CENTER,   "Center",    "distance3"  },
      { ID_SURFLIST, "Surface",   "iPopChoice" },
      { ID_VMAPNAME, "VMap Name", "string"     },
      { 0 }
   };
   LWXPanelDataDesc cdata[] = {
      { ID_SIZE,     "Size",      "distance3" },
      { ID_CENTER,   "Center",    "distance3" },
      { ID_SURFLIST, "Surface",   "integer"   },
      { ID_VMAPNAME, "VMap Name", "string"    },
      { 0 }
   };
   LWXPanelHint hint[] = {
      XpLABEL( 0, "Box Tutorial Part 3" ),
      XpDIVADD( ID_SIZE ),
      XpDIVADD( ID_CENTER ),
      XpSTRLIST( ID_SURFLIST, surflist ),
      XpEND
   };

   panel = xpanf->create( LWXP_FORM, ctl );
   if ( !panel ) return 0;

   xpanf->describe( panel, cdata, NULL, NULL );
   xpanf->hint( panel, 0, hint );
   xpanf->formSet( panel, ID_SIZE, size );
   xpanf->formSet( panel, ID_CENTER, center );
   xpanf->formSet( panel, ID_SURFLIST, 0 );
   xpanf->formSet( panel, ID_VMAPNAME, vmapname );

   ok = xpanf->post( panel );

   if ( ok ) {
      double *d;
      int *i;
      char *a;

      d = xpanf->formGet( panel, ID_SIZE );
      size[ 0 ] = d[ 0 ];
      size[ 1 ] = d[ 1 ];
      size[ 2 ] = d[ 2 ];

      d = xpanf->formGet( panel, ID_CENTER );
      center[ 0 ] = d[ 0 ];
      center[ 1 ] = d[ 1 ];
      center[ 2 ] = d[ 2 ];

      i = xpanf->formGet( panel, ID_SURFLIST );
      strcpy( surfname, surflist[ *i ] );

      a = xpanf->formGet( panel, ID_VMAPNAME );
      strcpy( vmapname, a );
   }

   xpanf->destroy( panel );
   return ok;
}
示例#5
0
static LWXPanelID SuperQ_Panel( sqData *tool )
{
   static LWXPanelDataDesc def[] = {
      { XID_SID,  "Sides",      "integer"   },
      { XID_SEG,  "Segments",   "integer"   },
      { XID_TYPE, "Shape",      "integer"   },
      { XID_AXIS, "Axis",       "integer"   },
      { XID_CEN,  "Center",     "distance3" },
      { XID_RAD,  "Size",       "distance3" },
      { XID_DIAM, "Hole Size",  "distance"  },
      { XID_BF1,  "Top Bulge",  "float"     },
      { XID_BF2,  "Side Bulge", "float"     },
      { XID_ACTI, "--hidden--", "integer"   },
      { XID_UVS,  "Make UVs",   "integer"   },
      { 0 }
   };

   static LWXPanelControl con[] = {
      { XID_SID,  "Sides",      "integer"    },
      { XID_SEG,  "Segments",   "integer"    },
      { XID_TYPE, "Shape",      "iPopChoice" },
      { XID_AXIS, "Axis",       "axis"       },
      { XID_CEN,  "Center",     "distance3"  },
      { XID_RAD,  "Size",       "distance3"  },
      { XID_DIAM, "Hole Size",  "distance"   },
      { XID_BF1,  "Top Bulge",  "float"      },
      { XID_BF2,  "Side Bulge", "float"      },
      { XID_ACTI, "--hidden--", "integer"    },
      { XID_UVS,  "Make UVs",   "iBoolean"   },
      { 0 }
   };

   static LWXPanelHint hint[] = {
      XpDELETE( XID_ACTI ),
      XpSTRLIST( XID_TYPE, shapeNames ),
      XpENABLEMSG_( XID_ACTI, "Tool is currently inactive." ),
         XpH( XID_SID ),
         XpH( XID_SEG ),
         XpH( XID_AXIS ),
         XpH( XID_CEN ),
         XpH( XID_RAD ),
         XpH( XID_BF1 ),
         XpH( XID_BF2 ),
         XpH( XID_DIAM ),
         XpH( XID_TYPE ),
         XpH( XID_UVS ),
         XpEND,
      XpENABLEMSG_( XID_TYPE, "Ellipsoids don't have a hole!" ),
         XpH( XID_DIAM ),
         XpEND,
      XpMIN( XID_SID, 2 ),
      XpMAX( XID_SID, 256 ),
      XpMIN( XID_SEG, 2 ),
      XpMAX( XID_SEG, 256 ),
      XpMIN( XID_BF1, 0 ),
      XpMIN( XID_BF2, 0 ),
      XpEND
   };

   LWXPanelID pan;

   pan = xpanf->create( LWXP_VIEW, con );
   if ( !pan )
      return NULL;

   xpanf->describe( pan, def, SuperQ_Get, SuperQ_Set );
   xpanf->hint( pan, 0, hint );

   return pan;
}
示例#6
0
static LWXPanelID get_panel( AtmosphereData *dat )
{
   static LWXPanelControl ctrl_list[] = {
      { ID_MARCH, "Render Type",        "iPopChoice" },
      { ID_HI,    "Top",                "distance"   },
      { ID_LO,    "Bottom",             "distance"   },
      { ID_FA,    "Falloff",            "percent"    },
      { ID_DEN,   "Nominal Distance",   "distance"   },
      { ID_LUM,   "Luminosity",         "percent"    },
      { ID_OPA,   "Opacity",            "percent"    },
      { ID_BCK,   "Use Backdrop Color", "iBoolean"   },
      { ID_COL,   "Color",              "color"      },
      { ID_RES,   "Quality",            "iPopChoice" },
      { ID_TXTR,  "Use Texture",        "iBoolean"   },
      { ID_TXBT,  "Edit Texture",       "vButton"    },
      { 0 }
   };

   static LWXPanelDataDesc data_descrip[] = {
      { ID_MARCH, "Render Type",        "integer"    },
      { ID_HI,    "Top",                "distance"   },
      { ID_LO,    "Bottom",             "distance"   },
      { ID_FA,    "Falloff",            "percent"    },
      { ID_DEN,   "Nominal Distance",   "distance"   },
      { ID_LUM,   "Luminosity",         "percent"    },
      { ID_OPA,   "Opacity",            "percent"    },
      { ID_BCK,   "Use Backdrop Color", "integer"    },
      { ID_COL,   "Color",              "color"      },
      { ID_RES,   "Quality",            "integer"    },
      { ID_TXTR,  "Use Texture",        "integer"    },
      { ID_TXBT,  "Edit Texture",       NULL         },
      { 0 },
   };

   static char *quality[] = { "Very Low", "Low", "Medium", "Good", "Very Good", NULL };
   static char *render[] = { "Fast Fog", "Ray Marcher", NULL };
   static int bckMap[] = { 1, 0 };

   static LWXPanelHint hint[] = {
      XpLABEL( 0, "VFog Settings" ),
      XpDESTROYNOTIFY( destroy_notify ),
      XpBUTNOTIFY( ID_TXBT, button_event ),
      XpSTRLIST( ID_RES, quality ),
      XpSTRLIST( ID_MARCH, render ),

      XpGROUP_( ID_GGRP ),
         XpH( ID_HI ), XpH( ID_LO ), XpH( ID_FA ), XpH( ID_DEN ), XpEND,
      XpGROUP_( ID_SGRP ),
         XpH( ID_LUM ), XpH( ID_OPA ), XpH( ID_BCK ), XpH( ID_COL ), XpEND,
      XpGROUP_( ID_RGRP ),
         XpH( ID_RES ), XpH( ID_TXTR ), XpH( ID_TXBT ), XpEND,

      XpENABLE_( ID_MARCH ),
         XpH( ID_RGRP ), XpEND,
      XpENABLE_MAP_( ID_BCK, bckMap ),
         XpH( ID_COL ), XpEND,

      XpMIN( ID_LUM, 0 ), XpMAX( ID_LUM, 1 ),
      XpMIN( ID_OPA, 0 ), XpMAX( ID_OPA, 1 ),
      XpMIN( ID_FA, 0 ),  XpMAX( ID_FA, 1 ),

      XpEND
   };

   LWXPanelID panel;


   panel = xpanf->create( LWXP_VIEW, ctrl_list );
   if ( panel ) {
      xpanf->describe( panel, data_descrip, ui_get, ui_set );
      xpanf->hint( panel, 0, hint );
      xpanf->viewInst( panel, dat );
      xpanf->setData( panel, ID_TXBT, dat );
      xpanf->setData( panel, 0, dat );

      if ( !dat->txedID )
         dat->txedID = txedf->subscribe( "FogTexture",
            TEF_ALL - TEF_USEBTN, NULL, NULL, NULL, NULL );
   }

   return panel;
}