void MtlBlinnInputs3D::AddLightingShadowsBlinnInputs()
{
	InReceivesLighting = AddInput("Receives Lighting", "ReceivesLighting", 
		LINKID_DataType,			CLSID_DataType_Number,
		INPID_InputControl,		CHECKBOXCONTROL_ID,
		I3D_AutoFlags,				PF_AutoProcess,
		INP_Default,				1.0,
		ICD_Width,					0.5,
		TAG_DONE);
		
	InReceivesShadows = AddInput("Receives Shadows", "ReceivesShadows", 
		LINKID_DataType,			CLSID_DataType_Number,
		INPID_InputControl,		CHECKBOXCONTROL_ID,
		I3D_AutoFlags,				PF_AutoProcess,
		INP_Default,				1.0,
		ICD_Width,					0.5,
		TAG_DONE);

	InUseTwoSidedLighting = AddInput("Two Sided Lighting", "UseTwoSidedLighting", 
		LINKID_DataType,			CLSID_DataType_Number,
		INPID_InputControl,		CHECKBOXCONTROL_ID,
		I3D_AutoFlags,				PF_AutoProcess,
		INP_Default,				0.0,
		ICD_Width,					0.5,
		TAG_DONE);
}
예제 #2
0
파일: httpd-io.c 프로젝트: Oxyoptia/x3270
/**
 * Asynchronous completion.
 *
 * @param[in] dhandle   State
 * @param[in] rv        Completion status
 */
void
hio_async_done(void *dhandle, httpd_status_t rv)
{
    session_t *session = httpd_mhandle(dhandle);

    if (rv < 0) {
	hio_socket_close(session);
	return;
    }

    /* Allow more input. */
    if (session->ioid == NULL_IOID) {
#if !defined(_WIN32) /*[*/
	session->ioid = AddInput(session->s, hio_socket_input);
#else /*][*/
	session->ioid = AddInput(session->event, hio_socket_input);
#endif /*]*/
    }

    /*
     * Set a timeout for that input to arrive. We didn't set this timeout
     * as soon as the last input arrived, because it might have taken us a
     * long time to proces the last request.
     */
    if (session->toid == NULL_IOID) {
	session->toid = AddTimeOut(IDLE_MAX * 1000, hio_timeout);
    }
}
KeyboardMouse::KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device,
                             const LPDIRECTINPUTDEVICE8 mo_device, HWND hwnd)
    : m_kb_device(kb_device), m_mo_device(mo_device), m_hwnd(hwnd), m_last_update(GetTickCount()),
      m_state_in()
{
  s_keyboard_mouse_exists = true;

  m_kb_device->Acquire();
  m_mo_device->Acquire();

  // KEYBOARD
  // add keys
  for (u8 i = 0; i < sizeof(named_keys) / sizeof(*named_keys); ++i)
    AddInput(new Key(i, m_state_in.keyboard[named_keys[i].code]));

  // MOUSE
  DIDEVCAPS mouse_caps = {};
  mouse_caps.dwSize = sizeof(mouse_caps);
  m_mo_device->GetCapabilities(&mouse_caps);
  // mouse buttons
  for (u8 i = 0; i < mouse_caps.dwButtons; ++i)
    AddInput(new Button(i, m_state_in.mouse.rgbButtons[i]));
  // mouse axes
  for (unsigned int i = 0; i < mouse_caps.dwAxes; ++i)
  {
    const LONG& ax = (&m_state_in.mouse.lX)[i];

    // each axis gets a negative and a positive input instance associated with it
    AddInput(new Axis(i, ax, (2 == i) ? -1 : -MOUSE_AXIS_SENSITIVITY));
    AddInput(new Axis(i, ax, -(2 == i) ? 1 : MOUSE_AXIS_SENSITIVITY));
  }
  // cursor, with a hax for-loop
  for (unsigned int i = 0; i < 4; ++i)
    AddInput(new Cursor(!!(i & 2), (&m_state_in.cursor.x)[i / 2], !!(i & 1)));
}
예제 #4
0
xmlNode* FArchiveXML::WriteGeometryMesh(FCDObject* object, xmlNode* parentNode)
{
    FCDGeometryMesh* geometryMesh = (FCDGeometryMesh*)object;

    xmlNode* meshNode = NULL;

    if (geometryMesh->IsConvex() && !geometryMesh->GetConvexHullOf().empty())
    {
        meshNode = AddChild(parentNode, DAE_CONVEX_MESH_ELEMENT);
        FUSStringBuilder convexHullOfName(geometryMesh->GetConvexHullOf());
        AddAttribute(meshNode, DAE_CONVEX_HULL_OF_ATTRIBUTE, convexHullOfName);
    }
    else
    {
        meshNode = AddChild(parentNode, DAE_MESH_ELEMENT);

        // Write out the sources
        for (size_t i = 0; i < geometryMesh->GetSourceCount(); ++i)
        {
            FArchiveXML::LetWriteObject(geometryMesh->GetSource(i), meshNode);
        }

        // Write out the <vertices> element
        xmlNode* verticesNode = AddChild(meshNode, DAE_VERTICES_ELEMENT);
        xmlNode* verticesInputExtraNode = NULL,* verticesInputExtraTechniqueNode = NULL;
        for (size_t i = 0; i < geometryMesh->GetVertexSourceCount(); ++i)
        {
            FCDGeometrySource* source = geometryMesh->GetVertexSource(i);
            const char* semantic = FUDaeGeometryInput::ToString(source->GetType());
            AddInput(verticesNode, source->GetDaeId(), semantic);
            if (geometryMesh->GetPolygonsCount() > 0)
            {
                FCDGeometryPolygons* firstPolys = geometryMesh->GetPolygons(0);
                FCDGeometryPolygonsInput* input = firstPolys->FindInput(source);
                FUAssert(input != NULL, continue);
                if (input->GetSet() != -1)
                {
                    // We are interested in the set information, so if it is available, export it as an extra.
                    if (verticesInputExtraNode == NULL)
                    {
                        verticesInputExtraNode = FUXmlWriter::CreateNode(DAE_EXTRA_ELEMENT);
                        verticesInputExtraTechniqueNode = FUXmlWriter::AddChild(verticesInputExtraNode, DAE_TECHNIQUE_ELEMENT);
                        FUXmlWriter::AddAttribute(verticesInputExtraTechniqueNode, DAE_PROFILE_ATTRIBUTE, DAE_FCOLLADA_PROFILE);
                    }
                    AddInput(verticesInputExtraTechniqueNode, source->GetDaeId(), semantic, -1, input->GetSet());
                }
            }
        }
        if (verticesInputExtraNode != NULL) AddChild(verticesNode, verticesInputExtraNode);

        FUSStringBuilder verticesNodeId(geometryMesh->GetDaeId());
        verticesNodeId.append("-vertices");
        AddAttribute(verticesNode, DAE_ID_ATTRIBUTE, verticesNodeId);

        // Write out the polygons
        for (size_t i = 0; i < geometryMesh->GetPolygonsCount(); ++i)
        {
            FArchiveXML::LetWriteObject(geometryMesh->GetPolygons(i), meshNode);
        }
    }
예제 #5
0
Sum::Sum() :
    i1("input 1"), i2("input 2"), oSum("sum")
{
	AddInput(i1);
	AddInput(i2);
	AddOutput(oSum);
}
void CBlockVariableCounter::Init()
{
   AddInput(0, _T("~"));
   AddInput(0, _T("Start"));
   AddInput(0, _T("Step"));
   AddOutput(_T("Next"), 0);
   AddOutput(_T("Overflow"), 0);
}
예제 #7
0
KeyboardMouse::KeyboardMouse(Window window, int opcode, int pointer, int keyboard)
	: m_window(window), xi_opcode(opcode), pointer_deviceid(pointer), keyboard_deviceid(keyboard)
{
	memset(&m_state, 0, sizeof(m_state));

	// The cool thing about each KeyboardMouse object having its own Display
	// is that each one gets its own separate copy of the X11 event stream,
	// which it can individually filter to get just the events it's interested
	// in. So be aware that each KeyboardMouse object actually has its own X11
	// "context."
	m_display = XOpenDisplay(nullptr);

	int min_keycode, max_keycode;
	XDisplayKeycodes(m_display, &min_keycode, &max_keycode);

	int unused; // should always be 1
	XIDeviceInfo* pointer_device = XIQueryDevice(m_display, pointer_deviceid, &unused);
	name = std::string(pointer_device->name);
	XIFreeDeviceInfo(pointer_device);

	XIEventMask   mask;
	unsigned char mask_buf[(XI_LASTEVENT + 7)/8];

	mask.mask_len = sizeof(mask_buf);
	mask.mask = mask_buf;
	memset(mask_buf, 0, sizeof(mask_buf));

	XISetMask(mask_buf, XI_ButtonPress);
	XISetMask(mask_buf, XI_ButtonRelease);
	XISetMask(mask_buf, XI_RawMotion);
	XISetMask(mask_buf, XI_KeyPress);
	XISetMask(mask_buf, XI_KeyRelease);

	SelectEventsForDevice(DefaultRootWindow(m_display), &mask, pointer_deviceid);
	SelectEventsForDevice(DefaultRootWindow(m_display), &mask, keyboard_deviceid);

	// Keyboard Keys
	for (int i = min_keycode; i <= max_keycode; ++i)
	{
		Key* temp_key = new Key(m_display, i, m_state.keyboard);
		if (temp_key->m_keyname.length())
			AddInput(temp_key);
		else
			delete temp_key;
	}

	// Mouse Buttons
	for (int i = 0; i < 5; i++)
		AddInput(new Button(i, m_state.buttons));

	// Mouse Cursor, X-/+ and Y-/+
	for (int i = 0; i != 4; ++i)
		AddInput(new Cursor(!!(i & 2), !!(i & 1), (&m_state.cursor.x)[!!(i & 2)]));

	// Mouse Axis, X-/+ and Y-/+
	for (int i = 0; i != 4; ++i)
		AddInput(new Axis(!!(i & 2), !!(i & 1), (&m_state.axis.x)[!!(i & 2)]));
}
예제 #8
0
파일: httpd-io.c 프로젝트: Oxyoptia/x3270
/**
 * Initialize the httpd socket.
 *
 * @param[in] sa	address and port to listen on
 * @param[in] sa_len	length of sa
 */
void
hio_init(struct sockaddr *sa, socklen_t sa_len)
{
    int on = 1;

    listen_s = socket(sa->sa_family, SOCK_STREAM, 0);
    if (listen_s == INVALID_SOCKET) {
	popup_an_error("httpd socket: %s", socket_errtext());
	return;
    }
    if (setsockopt(listen_s, SOL_SOCKET, SO_REUSEADDR, (char *)&on,
		sizeof(on)) < 0) {
	popup_an_error("httpd setsockopt: %s", socket_errtext());
	SOCK_CLOSE(listen_s);
	listen_s = INVALID_SOCKET;
	return;
    }
    if (bind(listen_s, sa, sa_len) < 0) {
	popup_an_error("httpd bind: %s", socket_errtext());
	SOCK_CLOSE(listen_s);
	listen_s = INVALID_SOCKET;
	return;
    }
    if (listen(listen_s, 10) < 0) {
	popup_an_error("httpd listen: %s", socket_errtext());
	SOCK_CLOSE(listen_s);
	listen_s = INVALID_SOCKET;
	return;
    }
#if defined(_WIN32) /*[*/
    listen_event = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (listen_event == NULL) {
	popup_an_error("httpd: cannot create listen handle");
	SOCK_CLOSE(listen_s);
	listen_s = INVALID_SOCKET;
	return;
    }
    if (WSAEventSelect(listen_s, listen_event, FD_ACCEPT) != 0) {
	popup_an_error("httpd: WSAEventSelect failed: %s",
		socket_errtext());
	CloseHandle(listen_event);
	listen_event = INVALID_HANDLE_VALUE;
	SOCK_CLOSE(listen_s);
	listen_s = INVALID_SOCKET;
    }
    (void) AddInput(listen_event, hio_connection);
#else /*][*/
    (void) AddInput(listen_s, hio_connection);
#endif /*]*/
}
예제 #9
0
Device::Device(const XINPUT_CAPABILITIES& caps, u8 index)
	: m_index(index), m_subtype(caps.SubType)
{
	ZeroMemory(&m_state_out, sizeof(m_state_out));
	ZeroMemory(&m_current_state_out, sizeof(m_current_state_out));

	// XInputGetCaps seems to always claim all capabilities are supported
	// but I will leave all this stuff in, incase m$ fixes xinput up a bit

	// get supported buttons
	for (int i = 0; i != sizeof(named_buttons)/sizeof(*named_buttons); ++i)
	{
		// Guide button is never reported in caps
		if ((named_buttons[i].bitmask & caps.Gamepad.wButtons) ||
			((named_buttons[i].bitmask & XINPUT_GAMEPAD_GUIDE) && haveGuideButton))
			AddInput(new Button(i, m_state_in.Gamepad.wButtons));
	}

	// get supported triggers
	for (int i = 0; i != sizeof(named_triggers)/sizeof(*named_triggers); ++i)
	{
		//BYTE val = (&caps.Gamepad.bLeftTrigger)[i];  // should be max value / MSDN lies
		if ((&caps.Gamepad.bLeftTrigger)[i])
			AddInput(new Trigger(i, (&m_state_in.Gamepad.bLeftTrigger)[i], 255 ));
	}

	// get supported axes
	for (int i = 0; i != sizeof(named_axes)/sizeof(*named_axes); ++i)
	{
		//SHORT val = (&caps.Gamepad.sThumbLX)[i];  // xinput doesn't give the range / MSDN is a liar
		if ((&caps.Gamepad.sThumbLX)[i])
		{
			const SHORT& ax = (&m_state_in.Gamepad.sThumbLX)[i];

			// each axis gets a negative and a positive input instance associated with it
			AddInput(new Axis(i, ax, -32768));
			AddInput(new Axis(i, ax, 32767));
		}
	}

	// get supported motors
	for (int i = 0; i != sizeof(named_motors)/sizeof(*named_motors); ++i)
	{
		//WORD val = (&caps.Vibration.wLeftMotorSpeed)[i]; // should be max value / nope, more lies
		if ((&caps.Vibration.wLeftMotorSpeed)[i])
			AddOutput(new Motor(i, (&m_state_out.wLeftMotorSpeed)[i], 65535));
	}

	ClearInputState();
}
예제 #10
0
svlFilterImageCenterFinder::svlFilterImageCenterFinder() :
    svlFilterBase(),
    Smoothing(0.0),
    ThresholdLevel(10),
    MassRatio(50),
    LinkHorizontally(false),
    LinkVertically(true),
    EllipseFittingEnabled(false),
    EllipseFittingDrawEllipse(false),
    EllipseFittingSlices(32),
    EllipseFittingMode(0),
    EllipseFittingEdgeThreshold(100),
    EllipseFittingErrorThreshold(18),
    EllipseMaskEnabled(false),
    EllipseMaskSlices(32),
    EllipseMaskTransitionStart(0),
    EllipseMaskTransitionEnd(0),
    EllipseMargin(0),
    MaskImage(0),
    TransitionImage(0)
{
    AddInput("input", true);
    AddInputType("input", svlTypeImageRGB);
    AddInputType("input", svlTypeImageRGBStereo);

    AddOutput("output", true);
    SetAutomaticOutputType(true);
}
예제 #11
0
status_t
BMediaClient::RegisterInput(BMediaInput* input)
{
	input->ConnectionRegistered(this, ++fLastID);
	AddInput(input);
	return B_OK;
}
예제 #12
0
파일: runAlien.C 프로젝트: ktf/AliPhysics
//___________________________________________________________
void runAlien(TString data, TString mode = "test", Bool_t MC = kFALSE){  
  if(!gSystem->Getenv("ALICE_ROOT")){
    printf("AliRoot has to be initialized\n");  
    return;
  }
  
  // check for valid modes
  const int kModes = 5;
  TString allowed_modes[kModes] = {"proof", "prooftest", "test", "full", "submit"}; 
  Bool_t isValid = kFALSE;
  mode.ToLower();
  for(int imode = 0; imode < kModes; imode++){
    if(!mode.CompareTo(allowed_modes[imode])) isValid = kTRUE;
  }
  if(!isValid){
    printf("invalid analysis mode selected\n");
    return;
  }
  analysis_mode = mode; 
  Bool_t proofmode = mode.Contains("proof");
  // libraries to be loaded
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libCORRFW");
  gSystem->Load("libPWGhfe");
  
  // Create Analysis Manager
  AliAnalysisManager *runAnalysis = new AliAnalysisManager("Heavy Flavour Electron Analysis");
  runAnalysis->SetCommonFileName(output_file.Data());
  runAnalysis->SetInputEventHandler(new AliESDInputHandler); 
  if(MC) runAnalysis->SetMCtruthEventHandler(new AliMCEventHandler);
  AliAnalysisAlien *alienhandler = CreateAlienHandler(proofmode);
  printf("alienhandler %p\n", alienhandler);
  runAnalysis->SetGridHandler(alienhandler);
  //return;
  
  // Specify input (runs or dataset)
  if(!proofmode){
    // Query sample ID and runs
    TString sample;
    TArrayI listofruns;
    DecodeDataString(data, sample, listofruns);
    AddInput(alienhandler, sample, listofruns, MC);
  } else {
    alienhandler->SetProofDataSet(data);
  }

  // Add Tasks
  gROOT->LoadMacro(Form("%s/OADB/macros/AddTaskPhysicsSelection.C", gSystem->Getenv("ALICE_ROOT")));
  gROOT->LoadMacro(Form("%s/PWG3/hfe/macros/AddTaskHFE.C", gSystem->Getenv("ALICE_ROOT")));
  AddTaskPhysicsSelection(MC);
  AddTaskHFE();     // @TODO: MC and PbPb flag to be fixed

  // Run Analysis
  TString anamode = proofmode ? "proof" : "grid";
  if(runAnalysis->InitAnalysis()){
    runAnalysis->PrintStatus();
    runAnalysis->StartAnalysis(anamode);
  }
}
svlFilterImageExposureCorrection::svlFilterImageExposureCorrection() :
    svlFilterBase(),
    Brightness(0.0),
    Contrast(0.0),
    Gamma(0.0)
{
    CreateInterfaces();
    
    AddInput("input", true);
    AddInputType("input", svlTypeImageRGB);
    AddInputType("input", svlTypeImageRGBStereo);
    AddInputType("input", svlTypeImageRGBA);
    AddInputType("input", svlTypeImageRGBAStereo);
    AddInputType("input", svlTypeImageMono8);
    AddInputType("input", svlTypeImageMono8Stereo);

// Might be added in the future
//    AddInputType("input", svlTypeImageMono16);
//    AddInputType("input", svlTypeImageMono16Stereo);
//    AddInputType("input", svlTypeImageMono32);
//    AddInputType("input", svlTypeImageMono32Stereo);

    AddOutput("output", true);
    SetAutomaticOutputType(true);
}
예제 #14
0
svlFilterImageBlobTracker::svlFilterImageBlobTracker() :
    svlFilterBase(),
    OutputBlobs(0)
{
    AddInput("blobsmap", true);
    AddInputType("blobsmap", svlTypeImageMono32);
    AddInputType("blobsmap", svlTypeImageMono32Stereo);

    AddInput("blobs", false);
    AddInputType("blobs", svlTypeBlobs);

    AddOutput("blobsmap", true);
    SetAutomaticOutputType(true);

    AddOutput("blobs", false);
    SetOutputType("blobs", svlTypeBlobs);
}
예제 #15
0
CBaseMuxerFilter::CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
	: CBaseFilter(NAME("CBaseMuxerFilter"), pUnk, this, clsid)
	, m_rtCurrent(0)
{
	if(phr) *phr = S_OK;
	m_pOutput.Attach(new CBaseMuxerOutputPin(L"Output", this, this, phr));
	AddInput();
}
예제 #16
0
KeyboardMouse::KeyboardMouse(Window window) : m_window(window)
{
	memset(&m_state, 0, sizeof(m_state));

	m_display = XOpenDisplay(NULL);

	int min_keycode, max_keycode;
	XDisplayKeycodes(m_display, &min_keycode, &max_keycode);
	
	// Keyboard Keys
	for (int i = min_keycode; i <= max_keycode; ++i)
	{
		Key *temp_key = new Key(m_display, i, m_state.keyboard);
		if (temp_key->m_keyname.length())
			AddInput(temp_key);
		else
			delete temp_key;
	}

	// Mouse Buttons
	AddInput(new Button(Button1Mask, m_state.buttons));
	AddInput(new Button(Button2Mask, m_state.buttons));
	AddInput(new Button(Button3Mask, m_state.buttons));
	AddInput(new Button(Button4Mask, m_state.buttons));
	AddInput(new Button(Button5Mask, m_state.buttons));

	// Mouse Cursor, X-/+ and Y-/+
	for (int i = 0; i != 4; ++i)
		AddInput(new Cursor(!!(i & 2), !!(i & 1), (&m_state.cursor.x)[!!(i & 2)]));
}
예제 #17
0
svlOSGImage::svlOSGImage() :
  svlFilterBase(),
  image( NULL ){
  
  AddInput("input", true);
  AddInputType("input", svlTypeImageMono8);
  AddInputType("input", svlTypeImageMono8Stereo);

}
예제 #18
0
CMyFilter1::CMyFilter1() :
    svlFilterBase()                                                       // Call baseclass' constructor
{                                                                         //
    AddInput("input", true);                                              // Create synchronous input connector
    AddInputType("input", svlTypeImageRGB);                               // Set sample type for input connector
                                                                          //
    AddOutput("output", true);                                            // Create synchronous ouput connector
    SetAutomaticOutputType(true);                                         // Set output sample type the same as input sample type
}
예제 #19
0
KeyboardMouse::KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIRECTINPUTDEVICE8 mo_device)
	: m_kb_device(kb_device)
	, m_mo_device(mo_device)
{
	m_kb_device->Acquire();
	m_mo_device->Acquire();

	m_last_update = GetTickCount();

	ZeroMemory(&m_state_in, sizeof(m_state_in));
	ZeroMemory(m_state_out, sizeof(m_state_out));
	ZeroMemory(&m_current_state_out, sizeof(m_current_state_out));

	// KEYBOARD
	// add keys
	for (u8 i = 0; i < sizeof(named_keys)/sizeof(*named_keys); ++i)
		AddInput(new Key(i, m_state_in.keyboard[named_keys[i].code]));
	// add lights
	for (u8 i = 0; i < sizeof(named_lights)/sizeof(*named_lights); ++i)
		AddOutput(new Light(i));

	// MOUSE
	// get caps
	DIDEVCAPS mouse_caps;
	ZeroMemory( &mouse_caps, sizeof(mouse_caps) );
	mouse_caps.dwSize = sizeof(mouse_caps);
	m_mo_device->GetCapabilities(&mouse_caps);
	// mouse buttons
	for (u8 i = 0; i < mouse_caps.dwButtons; ++i)
		AddInput(new Button(i, m_state_in.mouse.rgbButtons[i]));
	// mouse axes
	for (unsigned int i = 0; i < mouse_caps.dwAxes; ++i)
	{
		const LONG& ax = (&m_state_in.mouse.lX)[i];

		// each axis gets a negative and a positive input instance associated with it
		AddInput(new Axis(i, ax, (2==i) ? -1 : -MOUSE_AXIS_SENSITIVITY));
		AddInput(new Axis(i, ax, -(2==i) ? 1 : MOUSE_AXIS_SENSITIVITY));
	}
	// cursor, with a hax for-loop
	for (unsigned int i=0; i<4; ++i)
		AddInput(new Cursor(!!(i&2), (&m_state_in.cursor.x)[i/2], !!(i&1)));
}
예제 #20
0
Touchscreen::Touchscreen(int padID)
	: _padID(padID)
{
	AddInput(new Button(_padID, ButtonManager::BUTTON_A));
	AddInput(new Button(_padID, ButtonManager::BUTTON_B));
	AddInput(new Button(_padID, ButtonManager::BUTTON_START));
	AddInput(new Button(_padID, ButtonManager::BUTTON_X));
	AddInput(new Button(_padID, ButtonManager::BUTTON_Y));
	AddInput(new Button(_padID, ButtonManager::BUTTON_Z));
	AddInput(new Button(_padID, ButtonManager::BUTTON_UP));
	AddInput(new Button(_padID, ButtonManager::BUTTON_DOWN));
	AddInput(new Button(_padID, ButtonManager::BUTTON_LEFT));
	AddInput(new Button(_padID, ButtonManager::BUTTON_RIGHT));
	AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT));
	AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN));
	AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_C_DOWN));
	AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_C_RIGHT));
	AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_L), new Axis(_padID, ButtonManager::TRIGGER_L));
	AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_R), new Axis(_padID, ButtonManager::TRIGGER_R));
}
예제 #21
0
svlOSGImage::svlOSGImage( float x, float y,  
			  float width, float height, 
			  osaOSGHUD* hud ):
  svlFilterBase(){
  
  AddInput("input", true);
  AddInputType("input", svlTypeImageMono8);
  AddInputType("input", svlTypeImageMono8Stereo);

  image = new svlOSGImage::Image( x, y, width, height, hud );
  image->svlImage = this;

}
void MtlBlinnInputs3D::AddBumpmapBlinnInputs()
{
	InBumpmapMtl = AddInput("Bumpmap Material", "Bumpmap.Material",
		LINKID_DataType,			CLSID_DataType_MtlGraph3D,
		//LINKID_AllowedDataType,	CLSID_DataType_Image,	// no! - the bumpmap isn't trivial, it has to transform normals to 'texture' basis
		LINKID_LegacyID,			FuID("BumpmapTex"),
		I3D_AutoFlags,				PF_AutoProcess,
		I3D_ParamName,				FuID("BumpmapMtl"),
		I3D_ChildSlot,				MtlBlinnData3D::CMS_Bumpmap,
		LINK_Main,					MMID_Bumpmap,
		INP_Required,				FALSE, 
		LINKID_OverideDefLink,	LinkType_Eye_Normal,
		TAG_DONE);
}
예제 #23
0
Device::Device(const XINPUT_CAPABILITIES& caps, u8 index) : m_subtype(caps.SubType), m_index(index)
{
  // XInputGetCaps can be broken on some devices, so we'll just ignore it
  // and assume all gamepad + vibration capabilities are supported

  // get supported buttons
  for (int i = 0; i != sizeof(named_buttons) / sizeof(*named_buttons); ++i)
  {
    // Only add guide button if we have the 100 ordinal XInputGetState
    if (!(named_buttons[i].bitmask & XINPUT_GAMEPAD_GUIDE) || haveGuideButton)
      AddInput(new Button(i, m_state_in.Gamepad.wButtons));
  }

  // get supported triggers
  for (int i = 0; i != sizeof(named_triggers) / sizeof(*named_triggers); ++i)
  {
    AddInput(new Trigger(i, (&m_state_in.Gamepad.bLeftTrigger)[i], 255));
  }

  // get supported axes
  for (int i = 0; i != sizeof(named_axes) / sizeof(*named_axes); ++i)
  {
    const SHORT& ax = (&m_state_in.Gamepad.sThumbLX)[i];

    // each axis gets a negative and a positive input instance associated with it
    AddInput(new Axis(i, ax, -32768));
    AddInput(new Axis(i, ax, 32767));
  }

  // get supported motors
  for (int i = 0; i != sizeof(named_motors) / sizeof(*named_motors); ++i)
  {
    AddOutput(new Motor(i, this, (&m_state_out.wLeftMotorSpeed)[i], 65535));
  }

  ZeroMemory(&m_state_in, sizeof(m_state_in));
}
예제 #24
0
evdevDevice::evdevDevice(const std::string& devnode) : m_devfile(devnode)
{
  // The device file will be read on one of the main threads, so we open in non-blocking mode.
  m_fd = open(devnode.c_str(), O_RDWR | O_NONBLOCK);
  int ret = libevdev_new_from_fd(m_fd, &m_dev);

  if (ret != 0)
  {
    // This useally fails because the device node isn't an evdev device, such as /dev/input/js0
    m_initialized = false;
    close(m_fd);
    return;
  }

  m_name = StripSpaces(libevdev_get_name(m_dev));

  // Controller buttons (and keyboard keys)
  int num_buttons = 0;
  for (int key = 0; key < KEY_MAX; key++)
    if (libevdev_has_event_code(m_dev, EV_KEY, key))
      AddInput(new Button(num_buttons++, key, m_dev));

  // Absolute axis (thumbsticks)
  int num_axis = 0;
  for (int axis = 0; axis < 0x100; axis++)
    if (libevdev_has_event_code(m_dev, EV_ABS, axis))
    {
      AddAnalogInputs(new Axis(num_axis, axis, false, m_dev),
                      new Axis(num_axis, axis, true, m_dev));
      num_axis++;
    }

  // Force feedback
  if (libevdev_has_event_code(m_dev, EV_FF, FF_PERIODIC))
  {
    for (auto type : {FF_SINE, FF_SQUARE, FF_TRIANGLE, FF_SAW_UP, FF_SAW_DOWN})
      if (libevdev_has_event_code(m_dev, EV_FF, type))
        AddOutput(new ForceFeedback(type, m_dev));
  }
  if (libevdev_has_event_code(m_dev, EV_FF, FF_RUMBLE))
  {
    AddOutput(new ForceFeedback(FF_RUMBLE, m_dev));
  }

  // TODO: Add leds as output devices

  m_initialized = true;
  m_interesting = num_axis >= 2 || num_buttons >= 8;
}
예제 #25
0
svlFilterSplitter::svlFilterSplitter() :
    svlFilterBase()
{
    CreateInterfaces();

    AddInput("input", true);
    AddInputType("input", svlTypeImageRGB);
    AddInputType("input", svlTypeImageRGBA);
    AddInputType("input", svlTypeImageRGBStereo);
    AddInputType("input", svlTypeImageRGBAStereo);
    AddInputType("input", svlTypeImageMono8);
    AddInputType("input", svlTypeImageMono8Stereo);
    AddInputType("input", svlTypeImageMono16);
    AddInputType("input", svlTypeImageMono16Stereo);
    AddInputType("input", svlTypeImageMono32);
    AddInputType("input", svlTypeImageMono32Stereo);
    AddInputType("input", svlTypeImage3DMap);
    AddInputType("input", svlTypeCUDAImageRGB);
    AddInputType("input", svlTypeCUDAImageRGBA);
    AddInputType("input", svlTypeCUDAImageRGBStereo);
    AddInputType("input", svlTypeCUDAImageRGBAStereo);
    AddInputType("input", svlTypeCUDAImageMono8);
    AddInputType("input", svlTypeCUDAImageMono8Stereo);
    AddInputType("input", svlTypeCUDAImageMono16);
    AddInputType("input", svlTypeCUDAImageMono16Stereo);
    AddInputType("input", svlTypeCUDAImageMono32);
    AddInputType("input", svlTypeCUDAImageMono32Stereo);
    AddInputType("input", svlTypeCUDAImage3DMap);
    AddInputType("input", svlTypeMatrixInt8);
    AddInputType("input", svlTypeMatrixInt16);
    AddInputType("input", svlTypeMatrixInt32);
    AddInputType("input", svlTypeMatrixInt64);
    AddInputType("input", svlTypeMatrixUInt8);
    AddInputType("input", svlTypeMatrixUInt16);
    AddInputType("input", svlTypeMatrixUInt32);
    AddInputType("input", svlTypeMatrixUInt64);
    AddInputType("input", svlTypeMatrixFloat);
    AddInputType("input", svlTypeMatrixDouble);
    AddInputType("input", svlTypeTransform3D);
    AddInputType("input", svlTypeTargets);
    AddInputType("input", svlTypeText);
    AddInputType("input", svlTypeBlobs);

    // Add the trunk output by default
    svlFilterBase::AddOutput("output", true);
    SetAutomaticOutputType(false);
}
예제 #26
0
svlFilterCapFramerate::svlFilterCapFramerate() :
svlFilterBase(),
    TimeForLastFrame(0.0)
{
    AddInput("input", true);
    AddInputType("input", svlTypeImageRGB);
    AddInputType("input", svlTypeImageRGBA);
    AddInputType("input", svlTypeImageRGBStereo);
    AddInputType("input", svlTypeImageRGBAStereo);
    AddInputType("input", svlTypeImageMono8);
    AddInputType("input", svlTypeImageMono8Stereo);
    AddInputType("input", svlTypeImageMono16);
    AddInputType("input", svlTypeImageMono16Stereo);
    AddInputType("input", svlTypeImageMono32);
    AddInputType("input", svlTypeImageMono32Stereo);
    AddInputType("input", svlTypeImage3DMap);
    AddInputType("input", svlTypeCUDAImageRGB);
    AddInputType("input", svlTypeCUDAImageRGBA);
    AddInputType("input", svlTypeCUDAImageRGBStereo);
    AddInputType("input", svlTypeCUDAImageRGBAStereo);
    AddInputType("input", svlTypeCUDAImageMono8);
    AddInputType("input", svlTypeCUDAImageMono8Stereo);
    AddInputType("input", svlTypeCUDAImageMono16);
    AddInputType("input", svlTypeCUDAImageMono16Stereo);
    AddInputType("input", svlTypeCUDAImageMono32);
    AddInputType("input", svlTypeCUDAImageMono32Stereo);
    AddInputType("input", svlTypeCUDAImage3DMap);
    AddInputType("input", svlTypeMatrixInt8);
    AddInputType("input", svlTypeMatrixInt16);
    AddInputType("input", svlTypeMatrixInt32);
    AddInputType("input", svlTypeMatrixInt64);
    AddInputType("input", svlTypeMatrixUInt8);
    AddInputType("input", svlTypeMatrixUInt16);
    AddInputType("input", svlTypeMatrixUInt32);
    AddInputType("input", svlTypeMatrixUInt64);
    AddInputType("input", svlTypeMatrixFloat);
    AddInputType("input", svlTypeMatrixDouble);
    AddInputType("input", svlTypeTransform3D);
    AddInputType("input", svlTypeTargets);
    AddInputType("input", svlTypeText);
    AddInputType("input", svlTypeBlobs);

    AddOutput("output", true);
    SetAutomaticOutputType(true);
}
예제 #27
0
PipeDevice::PipeDevice(int fd, const std::string& name, int id) : m_fd(fd), m_name(name), m_id(id)
{
  for (const auto& tok : s_button_tokens)
  {
    PipeInput* btn = new PipeInput("Button " + tok);
    AddInput(btn);
    m_buttons[tok] = btn;
  }
  for (const auto& tok : s_shoulder_tokens)
  {
    AddAxis(tok, 0.0);
  }
  for (const auto& tok : s_axis_tokens)
  {
    AddAxis(tok + " X", 0.5);
    AddAxis(tok + " Y", 0.5);
  }
}
svlFilterImageColorSegmentation::svlFilterImageColorSegmentation() :
    svlFilterBase(),
    OutputImage(0)
{
    AddInput("input", true);
    AddInputType("input", svlTypeImageRGB);
    AddInputType("input", svlTypeImageRGBStereo);

    AddOutput("output", true);

    // Calculate Square Root Look-up Table Normalized to 0-255
    const unsigned int len = 3 * 255 * 255;
    const unsigned int maxval = static_cast<unsigned int>(sqrt(static_cast<float>(len)));
    NormSqrtLUT.SetSize(len);
    for (unsigned int i = 0; i < len; i ++) {
        NormSqrtLUT[i] = 255 * static_cast<unsigned int>(sqrt(static_cast<float>(i))) / maxval;
    }
}
void iAFoamCharacterizationItemBinarization::executeBinarization()
{
	iAConnector con;
	con.SetImage(m_pImageData);
	QScopedPointer<iAProgress> pObserver(new iAProgress());
	connect(pObserver.data(), SIGNAL(pprogress(const int&)), this, SLOT(slotObserver(const int&)));
	auto filter = iAFilterRegistry::Filter("Binary Thresholding");
	filter->SetLogger(iAConsoleLogger::Get());
	filter->SetProgress(pObserver.data());
	filter->AddInput(&con);
	QMap<QString, QVariant> parameters;
	parameters["Lower threshold"] = m_usLowerThreshold;
	parameters["Upper threshold"] = m_usUpperThreshold;
	parameters["Inside value"] = 0;
	parameters["Outside value"] = 1;
	filter->Run(parameters);
	m_pImageData->DeepCopy(filter->Output()[0]->GetVTKImage());
	m_pImageData->CopyInformationFromPipeline(filter->Output()[0]->GetVTKImage()->GetInformation());
}
예제 #30
0
svlFilterImageWindow::svlFilterImageWindow() :
    svlFilterBase(),
    FullScreenFlag(false),
    PositionSetFlag(false),
    IsVisible(true),
    Thread(0),
    ThreadProc(0),
    WindowManager(0),
    EventHandler(0)
{
    CreateInterfaces();
    
    AddInput("input", true);
    AddInputType("input", svlTypeImageRGB);
    AddInputType("input", svlTypeImageRGBStereo);

    AddOutput("output", true);
    SetAutomaticOutputType(true);
}