Пример #1
0
ECODE DTFUN::ConfigAD( UINT ChanType,
                       UINT ListSize,
                       DBL  Gain,
                       int  ClockSource,
                       DBL  Freq,
                       DWORD BufSize   )
{
    int status;

    ECODE result= 0;
    BufferSize= (int)BufSize;

    result+= SetChanType( ChanType );
    result+= SetChanList( ListSize, Gain );
    Freq= SetClock(ClockSource, Freq );       // ClockSource=0 ... internal, 1=external
    result+= SetWndHandle();
    result+= SetBuffers( BufSize );

    ClockHz= Freq;

    // do we want to output the sample clock onto the user counter pin?
    // (this user counter pin can then be used as an A/D sample clock input for another board
    // and is also used to drive this particular board
    // NOTE that the user counter pin has to be wired externally to the A/D Sample Clock In pin
    if (outputclockonusercounter)
    {
        // set the cascade mode
        status= olDaSetCascadeMode(lphDassCT, OL_CT_SINGLE);
        // set up the clocks and gates
        // use an internal clock
        status= olDaSetClockSource(lphDassCT, OL_CLK_INTERNAL);
        // set the clock frequency
        status= olDaSetClockFrequency(lphDassCT, ClockHz);
        // specify the gate to enable the C/T operation
        status= olDaSetGateType(lphDassCT, OL_GATE_NONE);
        // status= olDaSetGateType(lphDassCT, OL_GATE_HIGH_LEVEL);
        // specify the mode for continuous output
        status= olDaSetCTMode(lphDassCT, OL_CTMODE_RATE);    // as opposed to OL_CTMODE_ONESHOT
        // specify the output pulse type
        status= olDaSetPulseType(lphDassCT, OL_PLS_HIGH2LOW);
        // specify the duty cycle or pulse width
        status= olDaSetPulseWidth(lphDassCT, 100);
        // configure the subsystem
        status= olDaConfig( lphDassCT );
        // if we use a self-generated clock, then pre-start the A/D conversion here
        // start of sampling will be triggered when counter/clock is started
        status= olDaStart( lphDass );
    }

    return( result );
}
Пример #2
0
bool Model::LoadModel(
    const char* const filename,
    ComPtr<ID3D11Device> const device,
    const void* shaderBCode,
    const size_t bcodeLength)
{
    IndexedModel model;
    if (!LoadOBJFromFile(GetAssetPath(filename).c_str(), model))
    {
        return false;
    }

    initDimensions.depth = model.maxDepth;
    initDimensions.height = model.maxHeight;
    initDimensions.width = model.maxWidth;
    dimensions = initDimensions;

    return SetBuffers(device, shaderBCode, bcodeLength, model.vertices, model.indices);
}
Пример #3
0
void CIronBall::InsertModel()
{
	if (mpDevice == nullptr)
		return;

	mAllModelsVertices.push_back({ { 0.0f, RADIOBALL, 0.0f } });
	for (int i = 1; i < 8; i++)
	{
		for (int j = 0; j < 8; j++)
		{
			float x = sinf(0.3927f*i) * cosf(0.7854f*j) * RADIOBALL;
			float y = cosf(0.3927f*i) * RADIOBALL;
			float z = sinf(0.3927f*i) * sinf(0.7854f*j) * RADIOBALL;
			mAllModelsVertices.push_back({ { x, y, z } });
		}
	}
	mAllModelsVertices.push_back({ { 0.0f, -RADIOBALL, 0.0f } });

	for (unsigned short j = 0; j < 7; j++)
	{
		mAllModelsIndices.push_back(0);
		mAllModelsIndices.push_back(j + 2);
		mAllModelsIndices.push_back(j + 1);
	}
	mAllModelsIndices.push_back(0);
	mAllModelsIndices.push_back(1);
	mAllModelsIndices.push_back(8);

	for (unsigned short i = 1; i < 42; i += 8)
	{
		for (unsigned short j = 0; j < 7; j++)
		{
			mAllModelsIndices.push_back(j + i);
			mAllModelsIndices.push_back(j + i + 1);
			mAllModelsIndices.push_back(j + i + 8);

			mAllModelsIndices.push_back(j + i + 1);
			mAllModelsIndices.push_back(j + i + 9);
			mAllModelsIndices.push_back(j + i + 8);
		}
		mAllModelsIndices.push_back(i + 7);
		mAllModelsIndices.push_back(i);
		mAllModelsIndices.push_back(i + 15);

		mAllModelsIndices.push_back(i);
		mAllModelsIndices.push_back(i + 8);
		mAllModelsIndices.push_back(i + 15);
	}

	for (unsigned short j = 49; j < 56; j++)
	{
		mAllModelsIndices.push_back(57);
		mAllModelsIndices.push_back(j);
		mAllModelsIndices.push_back(j + 1);
	}
	mAllModelsIndices.push_back(56);
	mAllModelsIndices.push_back(49);
	mAllModelsIndices.push_back(57);

	SetBuffers();
}