Ejemplo n.º 1
0
void FORTE_INSYS_OUTPUT::executeEvent(int pa_nEIID){
  switch(pa_nEIID){
    case scm_nEventINITID:

    	output = std::make_unique<OutputSetterControl>(factory->getOutputSetter());

    	if(output) {
    		setInitialised();

			SUCCESS() = output->isControlStatusOK();
			RESPONSE().fromString(output->getControlStatusMessage().c_str());
    	} else {
    		resetInitialised();

			SUCCESS() = false;
			RESPONSE().fromString("ERROR: initialisation failed");
		}

		sendOutputEvent(scm_nEventINITOID);
      break;
    case scm_nEventREQID:

    	if(!QI()) {
    		SUCCESS() = false;
    		RESPONSE().fromString("QI is false");

    		sendOutputEvent(scm_nEventCNFID);

    		return;
    	}

    	if(!isInitialised()) {
    		SUCCESS() = false;
    		RESPONSE().fromString("ERROR: Not initialised");
    		return;
    	}

    	std::string outputName;

    	outputName = OUTPUT().getValue();
    	output->setOutputName(outputName);

    	output->setOutputState(CHANGE().getValue());

    	SUCCESS() = output->isControlStatusOK();
    	RESPONSE().fromString(output->getControlStatusMessage().c_str());

		sendOutputEvent(scm_nEventCNFID);
  }
}
Ejemplo n.º 2
0
void FORTE_MRX_INFO_LED::executeEvent(int pa_nEIID){
  switch(pa_nEIID){
	case scm_nEventINITID:

		cliCommander = std::make_unique<CliCommanderControl>(factory->getCliCommander());

		if(cliCommander) {
			setInitialised();

			SUCCESS() = cliCommander->isControlStatusOK();
			RESPONSE().fromString(cliCommander->getControlStatusMessage().c_str());
		} else {
			resetInitialised();

			SUCCESS() = false;
			RESPONSE().fromString("ERROR: initialisation failed");
		}

		sendOutputEvent(scm_nEventINITOID);
	  break;
	case scm_nEventREQID:
		if(!QI()) {
			SUCCESS() = false;
			RESPONSE().fromString("QI is false");

			sendOutputEvent(scm_nEventCNFID);

			return;
		}

		if(!isInitialised()) {
    		SUCCESS() = false;
    		RESPONSE().fromString("ERROR: Not initialised");

    		sendOutputEvent(scm_nEventCNFID);

    		return;
		}

		const std::string mode(MODE().getValue());

		if(mode != "on" && mode != "off" && mode != "flash") {
			SUCCESS() = false;
			RESPONSE().fromString("ERROR: Invalid mode");

			sendOutputEvent(scm_nEventCNFID);

			return;
		}

		std::string cliCommand = "help.debug.info_led.info_led=";

		cliCommand.append(MODE().getValue());
		cliCommander->sendCliCommand(cliCommand);

		if(!cliCommander->isControlStatusOK()) {
			SUCCESS() = cliCommander->isControlStatusOK();
			RESPONSE().fromString(cliCommander->getControlStatusMessage().c_str());

			sendOutputEvent(scm_nEventCNFID);
			return;
		}

		cliCommand = "help.debug.info_led.submit";
		cliCommander->sendCliCommand(cliCommand);

		SUCCESS() = cliCommander->isControlStatusOK();
		RESPONSE().fromString(cliCommander->getControlStatusMessage().c_str());

		sendOutputEvent(scm_nEventCNFID);
	  break;
  }
}
Ejemplo n.º 3
0
bool MeshRenderer::init()
{
	auto device = Sly::display->getDevice();
	
	addConstantBuffer(device, "material", sizeof(MaterialCB), 3);

	//Set samplerstate
	D3D11_SAMPLER_DESC sampDesc;
	ZeroMemory( &sampDesc, sizeof(sampDesc) );
	sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
	sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
	sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
	sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
	sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
	sampDesc.MinLOD = 0;
	sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
	addSamplerState(device, "linear", &sampDesc, 0);

	//Set blendstate
	D3D11_BLEND_DESC blendDesc;
	ZeroMemory( &blendDesc, sizeof(blendDesc));
	blendDesc.AlphaToCoverageEnable = false;
	blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
	blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_ZERO;
	blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
	blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
	blendDesc.RenderTarget[0].BlendEnable = false;
	blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
	blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
	blendDesc.RenderTarget[0].RenderTargetWriteMask = 0x0F;
	const float factor[4] = { 0.0f, 0.0f, 0.0f, 0.0f};
	addBlendState(device, "mesh", &blendDesc, factor, 0xFFFFFFFF);

	//Set depth stencil state
	D3D11_DEPTH_STENCIL_DESC depthDesc;
	ZeroMemory( &depthDesc, sizeof(depthDesc));
	depthDesc.DepthEnable = true;
	depthDesc.DepthFunc = D3D11_COMPARISON_LESS;
	depthDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
	addDepthStencilState(device, "mesh", &depthDesc, 0);

	//Set rasterizer state
	D3D11_RASTERIZER_DESC rasterizerDesc;
	ZeroMemory( &rasterizerDesc, sizeof(rasterizerDesc));
	rasterizerDesc.CullMode = D3D11_CULL_BACK;
	rasterizerDesc.FillMode = D3D11_FILL_SOLID;
	rasterizerDesc.DepthClipEnable = true;
	addRasterizerState(device, "mesh", &rasterizerDesc);

	D3D11_INPUT_ELEMENT_DESC layout[] =
	{
		{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
		{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0 }, 
	};

	Shader::createVertexShaderAndInputLayout(device, vertexShaderFilename_, &vertexShader_, &inputLayout_, layout,3);
	Shader::createPixelShader(device, pixelShaderFilename_, &pixelShader_);

	setInitialised(true);
	return true;
}
Ejemplo n.º 4
0
void MeshRenderer::clean()
{
	Memory::deleteDynamicContainer(drawBuffers_);
	setInitialised(false);
}