当前位置: 首页>>代码示例>>C++>>正文


C++ CDXUTDialog::GetSlider方法代码示例

本文整理汇总了C++中CDXUTDialog::GetSlider方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTDialog::GetSlider方法的具体用法?C++ CDXUTDialog::GetSlider怎么用?C++ CDXUTDialog::GetSlider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDXUTDialog的用法示例。


在下文中一共展示了CDXUTDialog::GetSlider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onPostUpdate

	virtual void onPostUpdate(grp::ISkeleton* skeleton)
	{
		int value = g_SampleUI.GetSlider(IDC_SLIDER_ARM)->GetValue();
		float arm_scale = 0.75f + value / 200.0f;
		value = g_SampleUI.GetSlider(IDC_SLIDER_LEG)->GetValue();
		float leg_scale = 0.75f + value / 200.0f;
		value = g_SampleUI.GetSlider(IDC_SLIDER_BODY)->GetValue();
		float body_scale = 0.75f + value / 200.0f;

		set_bone_scale(skeleton, L"Bip L UpperArm", arm_scale);
		set_bone_scale(skeleton, L"Bip L Forearm", arm_scale);
		set_bone_scale(skeleton, L"Bip R UpperArm", arm_scale);
		set_bone_scale(skeleton, L"Bip R Forearm", arm_scale);
		
		set_bone_scale(skeleton, L"Bip L Thigh", leg_scale);
		set_bone_scale(skeleton, L"Bip R Thigh", leg_scale);
		set_bone_scale(skeleton, L"Bip L Calf", leg_scale);
		set_bone_scale(skeleton, L"Bip R Calf", leg_scale);
		
		set_bone_scale(skeleton, L"Bip Pelvis", body_scale);
		set_bone_scale(skeleton, L"Bip Spine", body_scale);
		set_bone_scale(skeleton, L"Bip Spine1", body_scale);
		set_bone_scale(skeleton, L"Bip Spine2", body_scale);
		set_bone_scale(skeleton, L"Bip Spine3", body_scale);
	}
开发者ID:ColinGilbert,项目名称:grandpa-animation,代码行数:25,代码来源:BoneControlDemo.cpp

示例2: OnFrameRender

//--------------------------------------------------------------------------------------
// This callback function will be called at the end of every frame to perform all the 
// rendering calls for the scene, and it will also be called if the window needs to be 
// repainted. After this function has returned, DXUT will call 
// IDirect3DDevice9::Present to display the contents of the next buffer in the swap chain
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
    // If the settings dialog is being shown, then
    // render it instead of rendering the app's scene
    if( g_SettingsDlg.IsActive() )
    {
        g_SettingsDlg.OnRender( fElapsedTime );
        return;
    }

    HRESULT hr;

    // Clear the render target and the zbuffer 
    V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 50, 50, 50 ), 1.0f, 0 ) );

    // Render the scene
    if( SUCCEEDED( pd3dDevice->BeginScene() ) )
    {
        // Get the projection & view matrix from the camera class
        D3DXMATRIXA16 mViewProjection = ( *g_Camera.GetViewMatrix() ) * ( *g_Camera.GetProjMatrix() );

        g_Skybox.SetDrawSH( false );
        g_Skybox.Render( &mViewProjection, 1.0f, 1.0f );

        V( g_pEffect->SetMatrix( "g_mViewProjection", &mViewProjection ) );
        V( g_pEffect->SetFloat( "g_fTime", ( float )fTime ) );

        // Set the amount of transmitted light per color channel
        D3DXVECTOR3 vColorTransmit;
        vColorTransmit.x = g_SampleUI.GetSlider( IDC_RED_TRANSMIT_SLIDER )->GetValue() / 1000.0f;
        vColorTransmit.y = g_SampleUI.GetSlider( IDC_GREEN_TRANSMIT_SLIDER )->GetValue() / 1000.0f;
        vColorTransmit.z = g_SampleUI.GetSlider( IDC_BLUE_TRANSMIT_SLIDER )->GetValue() / 1000.0f;
        V( g_pEffect->SetFloatArray( "g_vColorTransmit", vColorTransmit, 3 ) );

        // for Cubic degree rendering
        V( g_pEffect->SetFloat( "g_fLightIntensity", g_fLightIntensity ) );
        V( g_pEffect->SetFloatArray( "g_vLightDirection", g_vLightDirection, 3 * sizeof( float ) ) );
        V( g_pEffect->SetFloatArray( "g_vLightCoeffsR", m_fRLC, 4 * sizeof( float ) ) );
        V( g_pEffect->SetFloatArray( "g_vLightCoeffsG", m_fGLC, 4 * sizeof( float ) ) );
        V( g_pEffect->SetFloatArray( "g_vLightCoeffsB", m_fBLC, 4 * sizeof( float ) ) );

        pd3dDevice->SetRenderState( D3DRS_FILLMODE, g_bWireFrame ? D3DFILL_WIREFRAME : D3DFILL_SOLID );

        DrawFrame( pd3dDevice, g_pFrameRoot );

        DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" ); // These events are to help PIX identify what the code is doing
        RenderText();
        V( g_HUD.OnRender( fElapsedTime ) );
        V( g_SampleUI.OnRender( fElapsedTime ) );
        V( g_LightControl.OnRender9( D3DXCOLOR( 1, 1, 1, 1 ), ( D3DXMATRIX* )g_Camera.GetViewMatrix(),
                                     ( D3DXMATRIX* )g_Camera.GetProjMatrix(), g_Camera.GetEyePt() ) );
        DXUT_EndPerfEvent();

        V( pd3dDevice->EndScene() );
    }
}
开发者ID:KNeal,项目名称:Oculus,代码行数:62,代码来源:LocalDeformablePRT.cpp

示例3: OnGUIEvent

//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
{

    switch( nControlID )
    {
        case IDC_TOGGLEFULLSCREEN:
            DXUTToggleFullScreen(); break;
        case IDC_TOGGLEREF:
            DXUTToggleREF(); break;
        case IDC_CHANGEDEVICE:
            g_SettingsDlg.SetActive( !g_SettingsDlg.IsActive() ); break;

        case IDC_ENABLE_PRESHADER:
        {
            g_bEnablePreshader = g_SampleUI.GetCheckBox( IDC_ENABLE_PRESHADER )->GetChecked();

            if( DXUTGetD3D9Device() != NULL )
            {
                OnLostDevice( NULL );
                OnDestroyDevice( NULL );
                OnCreateDevice( DXUTGetD3D9Device(), DXUTGetD3D9BackBufferSurfaceDesc(), NULL );
                OnResetDevice( DXUTGetD3D9Device(), DXUTGetD3D9BackBufferSurfaceDesc(), NULL );
            }
            break;
        }

        case IDC_ACTIVE_LIGHT:
            if( !g_LightControl[g_nActiveLight].IsBeingDragged() )
            {
                g_nActiveLight++;
                g_nActiveLight %= g_nNumActiveLights;
            }
            break;

        case IDC_NUM_LIGHTS:
            if( !g_LightControl[g_nActiveLight].IsBeingDragged() )
            {
                WCHAR sz[100];
                swprintf_s( sz, 100, L"# Lights: %d", g_SampleUI.GetSlider( IDC_NUM_LIGHTS )->GetValue() );
                g_SampleUI.GetStatic( IDC_NUM_LIGHTS_STATIC )->SetText( sz );

                g_nNumActiveLights = g_SampleUI.GetSlider( IDC_NUM_LIGHTS )->GetValue();
                g_nActiveLight %= g_nNumActiveLights;
            }
            break;

        case IDC_LIGHT_SCALE:
            g_fLightScale = ( float )( g_SampleUI.GetSlider( IDC_LIGHT_SCALE )->GetValue() * 0.10f );

            WCHAR sz[100];
            swprintf_s( sz, 100, L"Light scale: %0.2f", g_fLightScale );
            g_SampleUI.GetStatic( IDC_LIGHT_SCALE_STATIC )->SetText( sz );
            break;
    }

}
开发者ID:KNeal,项目名称:Oculus,代码行数:59,代码来源:BasicHLSL.cpp

示例4: setVisibleCustomControls

void setVisibleCustomControls(bool visible) {
    hud.GetStatic(IDC_THRESHOLD_LABEL)->SetVisible(visible);
    hud.GetSlider(IDC_THRESHOLD)->SetVisible(visible);
    hud.GetStatic(IDC_MAX_SEARCH_STEPS_LABEL)->SetVisible(visible);
    hud.GetSlider(IDC_MAX_SEARCH_STEPS)->SetVisible(visible);
    hud.GetStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL)->SetVisible(visible);
    hud.GetSlider(IDC_MAX_SEARCH_STEPS_DIAG)->SetVisible(visible);
    hud.GetStatic(IDC_CORNER_ROUNDING_LABEL)->SetVisible(visible);
    hud.GetSlider(IDC_CORNER_ROUNDING)->SetVisible(visible);
}
开发者ID:kphillisjr,项目名称:smaa,代码行数:10,代码来源:Demo.cpp

示例5: initApp

void initApp() {
    hud.Init(&dialogResourceManager);

    hud.SetCallback(onGUIEvent); int iY = 10;
    hud.AddButton(IDC_TOGGLE_FULLSCREEN, L"Toggle full screen", 35, iY, HUD_WIDTH, 22);

    iY += 24;

    hud.AddComboBox(IDC_PRESET, 35, iY += 24, HUD_WIDTH, 22, 0, false);
    hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Low", (LPVOID) 0);
    hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Medium", (LPVOID) 1);
    hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA High", (LPVOID) 2);
    hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Ultra", (LPVOID) 3);
    hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Custom", (LPVOID) 4);
    hud.GetComboBox(IDC_PRESET)->SetSelectedByData((LPVOID) 2);

    hud.AddComboBox(IDC_DETECTION_MODE, 35, iY += 24, HUD_WIDTH, 22, 0, false);
    hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Luma edge det.", (LPVOID) 0);
    hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Color edge det.", (LPVOID) 1);
    hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Depth edge det.", (LPVOID) 2);

    hud.AddCheckBox(IDC_ANTIALIASING, L"SMAA Anti-Aliasing", 35, iY += 24, HUD_WIDTH, 22, true);
    hud.AddCheckBox(IDC_PROFILE, L"Profile", 35, iY += 24, 125, 22, false);
    wstringstream s;
    s << L"Threshold: " << commandlineOptions.threshold;
    hud.AddStatic(IDC_THRESHOLD_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
    hud.AddSlider(IDC_THRESHOLD, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.threshold / 0.5f));
    hud.GetStatic(IDC_THRESHOLD_LABEL)->SetVisible(false);
    hud.GetSlider(IDC_THRESHOLD)->SetVisible(false);

    s = wstringstream();
    s << L"Max Search Steps: " << commandlineOptions.searchSteps;
    hud.AddStatic(IDC_MAX_SEARCH_STEPS_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
    hud.AddSlider(IDC_MAX_SEARCH_STEPS, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.searchSteps / 98.0f));
    hud.GetStatic(IDC_MAX_SEARCH_STEPS_LABEL)->SetVisible(false);
    hud.GetSlider(IDC_MAX_SEARCH_STEPS)->SetVisible(false);

    s = wstringstream();
    s << L"Max Diag. Search Steps: " << commandlineOptions.diagSearchSteps;
    hud.AddStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
    hud.AddSlider(IDC_MAX_SEARCH_STEPS_DIAG, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.diagSearchSteps / 20.0f));
    hud.GetStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL)->SetVisible(false);
    hud.GetSlider(IDC_MAX_SEARCH_STEPS_DIAG)->SetVisible(false);

    s = wstringstream();
    s << L"Corner Rounding: " << commandlineOptions.cornerRounding;
    hud.AddStatic(IDC_CORNER_ROUNDING_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
    hud.AddSlider(IDC_CORNER_ROUNDING, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.cornerRounding / 100.0f));
    hud.GetStatic(IDC_CORNER_ROUNDING_LABEL)->SetVisible(false);
    hud.GetSlider(IDC_CORNER_ROUNDING)->SetVisible(false);
	
}
开发者ID:kphillisjr,项目名称:smaa,代码行数:52,代码来源:Demo.cpp

示例6: setAnimationWeight

void setAnimationWeight()
{
	if (g_model == NULL)
	{
		return;
	}
#define SET_ANIMATION_WEIGHT(a, w)	\
	{\
		grp::IAnimation* animation = g_model->findAnimation(a);\
		if (animation != NULL)\
		{\
			animation->setWeight(w);\
		}\
	}

	float weight = g_SampleUI.GetSlider(IDC_SLIDER_WEIGHT)->GetValue() / 100.0f;
	if (weight < 0.5f)
	{
		SET_ANIMATION_WEIGHT(L"fight", 2 * (0.5f - weight));
		SET_ANIMATION_WEIGHT(L"walk", 2 * weight);
		SET_ANIMATION_WEIGHT(L"run", 0.0f);
		g_fCurSpeed = weight * WALK_SPEED * 2;
	}
	else
	{
		SET_ANIMATION_WEIGHT(L"fight", 0.0f);
		SET_ANIMATION_WEIGHT(L"walk", 2 * (1.0f - weight));
		SET_ANIMATION_WEIGHT(L"run", 2 * (weight - 0.5f));
		g_fCurSpeed = 2 * (WALK_SPEED * (1.0f - weight) + RUN_SPEED * (weight - 0.5f));
	}
}
开发者ID:ColinGilbert,项目名称:grandpa-animation,代码行数:31,代码来源:Demo.cpp

示例7: OnGUIEvent

//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, 
                          void* pUserContext )
{
    if( g_bGuiVisible )
    {
        switch( nControlID )
        {
            case IDC_TOGGLEFULLSCREEN:
                DXUTToggleFullScreen(); break;
            case IDC_TOGGLEREF:
                DXUTToggleREF(); break;
            case IDC_CHANGEDEVICE:
                g_D3DSettingsDlg.SetActive( !g_D3DSettingsDlg.IsActive() ); break;
            case IDC_SUNWIDTH_SLIDER:
                WCHAR temp[64];
                int iVal = g_HUD.GetSlider( IDC_SUNWIDTH_SLIDER )->GetValue();

                g_fSunWidth = ( float( iVal ) / 100.0f ) * 3.0f;
                swprintf_s( temp, L"SunWidth = %2.2f", g_fSunWidth );
                g_HUD.GetStatic( IDC_SUNWIDTH_TEXT )->SetText( temp );

                break;
        }
    }
}
开发者ID:KNeal,项目名称:Oculus,代码行数:28,代码来源:ContactHardeningShadows11.cpp

示例8: OnGUIEvent

//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent(UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext)
{

	switch(nControlID)
	{
	case IDC_SLIDER_TIMESCALE:
		{
			int iValue = g_SampleUI.GetSlider(IDC_SLIDER_TIMESCALE)->GetValue();
			if (iValue < 50)
			{
				g_fTimeScale = iValue / 50.0f;
			}
			else
			{
				g_fTimeScale = iValue / 10.0f - 4.0f;
			}
		}
		break;

	case IDC_SLIDER_WEIGHT:
		{
			if (g_model == NULL)
			{
				break;
			}
			setAnimationWeight();
			break;
		}
	}
}
开发者ID:ColinGilbert,项目名称:grandpa-animation,代码行数:33,代码来源:BoneControlDemo.cpp

示例9: OnGUIEvent

//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
{
    switch( nControlID )
    {
        case IDC_TOGGLEFULLSCREEN:
            DXUTToggleFullScreen(); break;
        case IDC_TOGGLEREF:
            DXUTToggleREF(); break;
        case IDC_CHANGEDEVICE:
            g_D3DSettingsDlg.SetActive( !g_D3DSettingsDlg.IsActive() ); break;
        case IDC_TOGGLEWARP:
            DXUTToggleWARP(); break;
        case IDC_TOGGLESPIN:
        {
            g_bSpinning = g_SampleUI.GetCheckBox( IDC_TOGGLESPIN )->GetChecked();
            break;
        }

        case IDC_EXPLODE_SCALE:
        {
            WCHAR sz[100];
            g_fExplode = ( float )( g_SampleUI.GetSlider( IDC_EXPLODE_SCALE )->GetValue() * 0.01f );
            swprintf_s( sz, 100, L"Explode Amount: %0.2f", g_fExplode );
            g_SampleUI.GetStatic( IDC_EXPLODE_STATIC )->SetText( sz );
            g_pExplodeVariable->SetFloat( g_fExplode );
            break;
        }
    }
}
开发者ID:KNeal,项目名称:Oculus,代码行数:32,代码来源:Tutorial13.cpp

示例10: UpdateLightingEnvironment

//--------------------------------------------------------------------------------------
void UpdateLightingEnvironment()
{
    // Gather lighting options from the HUD
    g_vLightDirection = g_LightControl.GetLightDirection();
    g_fLightIntensity = g_SampleUI.GetSlider( IDC_LIGHT_SLIDER )->GetValue() / 100.0f;
    g_fEnvIntensity = g_SampleUI.GetSlider( IDC_ENV_SLIDER )->GetValue() / 1000.0f;

    // Create the spotlight
    D3DXSHEvalConeLight( D3DXSH_MAXORDER, &g_vLightDirection, D3DX_PI / 8.0f,
                         g_fLightIntensity, g_fLightIntensity, g_fLightIntensity,
                         m_fRLC, m_fGLC, m_fBLC );

    float fSkybox[3][D3DXSH_MAXORDER*D3DXSH_MAXORDER];

    // Scale the light probe environment contribution based on input options    
    D3DXSHScale( fSkybox[0], D3DXSH_MAXORDER, g_fSkyBoxLightSH[0], g_fEnvIntensity );
    D3DXSHScale( fSkybox[1], D3DXSH_MAXORDER, g_fSkyBoxLightSH[1], g_fEnvIntensity );
    D3DXSHScale( fSkybox[2], D3DXSH_MAXORDER, g_fSkyBoxLightSH[2], g_fEnvIntensity );

    // Combine the environment and the spotlight
    D3DXSHAdd( m_fRLC, D3DXSH_MAXORDER, m_fRLC, fSkybox[0] );
    D3DXSHAdd( m_fGLC, D3DXSH_MAXORDER, m_fGLC, fSkybox[1] );
    D3DXSHAdd( m_fBLC, D3DXSH_MAXORDER, m_fBLC, fSkybox[2] );
}
开发者ID:KNeal,项目名称:Oculus,代码行数:25,代码来源:LocalDeformablePRT.cpp

示例11: OnFrameMove

//--------------------------------------------------------------------------------------
// This callback function will be called once at the beginning of every frame. This is the
// best location for your application to handle updates to the scene, but is not 
// intended to contain actual rendering calls, which should instead be placed in the 
// OnFrameRender callback.  
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );

    UpdateLightingEnvironment();

    if( g_pAnimController != NULL )
    {
        g_pAnimController->SetTrackSpeed( 0, g_SampleUI.GetSlider( IDC_ANIMATION_SPEED )->GetValue() / 1000.0f );
        g_pAnimController->AdvanceTime( fElapsedTime, NULL );
    }

    UpdateFrameMatrices( g_pFrameRoot, g_Camera.GetWorldMatrix() );
}
开发者ID:KNeal,项目名称:Oculus,代码行数:21,代码来源:LocalDeformablePRT.cpp

示例12: OnGUIEvent

//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent(UINT nEvent, int nControlID, CDXUTControl* pControl,
						 void* pUserContext)
{
	switch (nControlID)
	{
	case IDC_TOGGLEFULLSCREEN: DXUTToggleFullScreen(); break;

	case IDC_TOGGLEREF:        DXUTToggleREF(); break;

	case IDC_CHANGEDEVICE:     g_D3DSettingsDlg.SetActive(
			!g_D3DSettingsDlg.IsActive()); break;

	case IDC_DIFF_STEPS:
		g_vsObj->diffSteps = g_SampleUI.GetSlider(IDC_DIFF_STEPS)->GetValue();
		WCHAR sz[100];
		StringCchPrintf(sz, 100, L"Diffusion steps: %d", g_vsObj->diffSteps);
		g_SampleUI.GetStatic(IDC_DIFF_STEPS_STATIC)->SetText(sz);
		break;
	}
}
开发者ID:maleiwhat,项目名称:vectorizing-project,代码行数:23,代码来源:VolSurfaces10.cpp

示例13: OnGUIEvent

//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
{
    switch( nControlID )
    {
            // Standard DXUT controls
        case IDC_TOGGLEFULLSCREEN:
            DXUTToggleFullScreen(); break;
        case IDC_TOGGLEREF:
            DXUTToggleREF(); break;
        case IDC_CHANGEDEVICE:
            g_D3DSettingsDlg.SetActive( !g_D3DSettingsDlg.IsActive() ); break;

            // Custom app controls
        case IDC_PATCH_SUBDIVS:
        {
            g_fSubdivs = g_SampleUI.GetSlider( IDC_PATCH_SUBDIVS )->GetValue() / 10.0f;

            WCHAR sz[100];
            swprintf_s( sz, L"Patch Divisions: %2.1f", g_fSubdivs );
            g_SampleUI.GetStatic( IDC_PATCH_SUBDIVS_STATIC )->SetText( sz );
        }
            break;
        case IDC_TOGGLE_LINES:
            g_bDrawWires = g_SampleUI.GetCheckBox( IDC_TOGGLE_LINES )->GetChecked();
            break;
        case IDC_PARTITION_INTEGER:
            g_iPartitionMode = PARTITION_INTEGER;
            break;
        case IDC_PARTITION_FRAC_EVEN:
            g_iPartitionMode = PARTITION_FRACTIONAL_EVEN;
            break;
        case IDC_PARTITION_FRAC_ODD:
            g_iPartitionMode = PARTITION_FRACTIONAL_ODD;
            break;
    }
}
开发者ID:AndreAhmed,项目名称:directx-sdk-samples,代码行数:39,代码来源:SimpleBezier11.cpp

示例14: LoadTechniqueObjects

//--------------------------------------------------------------------------------------
// This function loads a new technique and all device objects it requires.
//--------------------------------------------------------------------------------------
HRESULT LoadTechniqueObjects( const char* szMedia )
{
    HRESULT hr = S_OK;

    if( NULL == g_pEffect )
        return D3DERR_INVALIDCALL;

    IDirect3DTexture9* pTexture = NULL;
    IDirect3DCubeTexture9* pCubeTexture = NULL;

    IDirect3DDevice9* pDevice = DXUTGetD3D9Device();

    WCHAR strFileName[MAX_PATH+1] = {0};
    WCHAR strPath[MAX_PATH+1] = {0};
    char strTechnique[MAX_PATH] = {0};

    // Make sure the technique works
    char* strComboTech = ( char* )g_SampleUI.GetComboBox( IDC_TECHNIQUE )->GetSelectedData();
    strcpy_s( strTechnique, MAX_PATH, strComboTech );
    bool bLDPRT = ( strTechnique && ( 0 == strcmp( strTechnique, "LDPRT" ) ) );

    // If we're not a signed format, make sure we use a technnique that will unbias
    if( D3DFMT_Q16W16V16U16 != g_fmtTexture && D3DFMT_Q8W8V8U8 != g_fmtTexture )
        strcat_s( strTechnique, MAX_PATH, "_Unbias" );

    D3DXHANDLE hTechnique = g_pEffect->GetTechniqueByName( strTechnique );
    V_RETURN( g_pEffect->SetTechnique( hTechnique ) );

    // Enable/disable LDPRT-only items
    g_SampleUI.GetStatic( IDC_ENV_LABEL )->SetEnabled( bLDPRT );
    g_SampleUI.GetSlider( IDC_ENV_SLIDER )->SetEnabled( bLDPRT );
    g_SampleUI.GetSlider( IDC_RED_TRANSMIT_SLIDER )->SetEnabled( bLDPRT );
    g_SampleUI.GetSlider( IDC_GREEN_TRANSMIT_SLIDER )->SetEnabled( bLDPRT );
    g_SampleUI.GetSlider( IDC_BLUE_TRANSMIT_SLIDER )->SetEnabled( bLDPRT );
    g_SampleUI.GetStatic( IDC_RED_TRANSMIT_LABEL )->SetEnabled( bLDPRT );
    g_SampleUI.GetStatic( IDC_GREEN_TRANSMIT_LABEL )->SetEnabled( bLDPRT );
    g_SampleUI.GetStatic( IDC_BLUE_TRANSMIT_LABEL )->SetEnabled( bLDPRT );

    // Load the mesh
    swprintf_s( strFileName, MAX_PATH, TEXT( "media\\%S" ), szMedia );
    V_RETURN( LoadLDPRTData( pDevice, strFileName ) );

    // Albedo texture
    swprintf_s( strFileName, MAX_PATH, TEXT( "media\\%SAlbedo.dds" ), szMedia );
    DXUTFindDXSDKMediaFileCch( strPath, MAX_PATH, strFileName );
    V( D3DXCreateTextureFromFile( pDevice, strPath, &pTexture ) );
    g_pEffect->SetTexture( "Albedo", pTexture );
    SAFE_RELEASE( pTexture );

    // Normal map 
    swprintf_s( strFileName, MAX_PATH, TEXT( "media\\%SNormalMap.dds" ), szMedia );
    DXUTFindDXSDKMediaFileCch( strPath, MAX_PATH, strFileName );
    V( D3DXCreateTextureFromFileEx( pDevice, strPath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0,
                                    g_fmtTexture, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0,
                                    NULL, NULL, &pTexture ) );
    g_pEffect->SetTexture( "NormalMap", pTexture );
    SAFE_RELEASE( pTexture );

    // Spherical harmonic basic functions
    char* pNames[4] = {"YlmCoeff0","YlmCoeff4","YlmCoeff8","YlmCoeff12"};
    for( int i = 0; i < 4; i++ )
    {
        D3DXCreateCubeTexture( pDevice, 32, 1, 0, g_fmtCubeMap, D3DPOOL_MANAGED, &pCubeTexture );
        D3DXFillCubeTexture( pCubeTexture, myFillBF, ( LPVOID )( INT_PTR )( i * 4 ) );
        g_pEffect->SetTexture( pNames[i], pCubeTexture );
        SAFE_RELEASE( pCubeTexture );
    }

    return S_OK;
}
开发者ID:KNeal,项目名称:Oculus,代码行数:73,代码来源:LocalDeformablePRT.cpp

示例15: OnGUIEvent

//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent(UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext)
{

	switch(nControlID)
	{
	case IDC_SLIDER_TIMESCALE:
		{
			int iValue = g_SampleUI.GetSlider(IDC_SLIDER_TIMESCALE)->GetValue();
			if (iValue < 50)
			{
				g_fTimeScale = iValue / 50.0f;
			}
			else
			{
				g_fTimeScale = iValue / 10.0f - 4.0f;
			}
		}
		break;

	case IDC_SLIDER_WEIGHT:
		{
			if (g_model == NULL)
			{
				break;
			}
			setAnimationWeight();
			break;
		}

	case IDC_BUTTON_ATTACK:
		if (g_model != NULL)
		{
			grp::IAnimation* fight = g_model->findAnimation(L"fight");
			if (fight != NULL && fight->getWeight() == 1.0f)
			{
				g_model->playAnimation(L"attack", grp::ANIMATION_SINGLE);
			}
			else
			{
				g_model->playAnimation(L"attack_up", grp::ANIMATION_SINGLE);
			}
		}
		break;
	case IDC_CHECK_RAGDOLL:
		if (g_SampleUI.GetCheckBox(IDC_CHECK_RAGDOLL)->GetChecked())
		{
			g_character->createRagdoll(g_model->getTransform());
		}
		else
		{
			g_character->destroyRagdoll();
		}
		break;
	case IDC_CHECK_GPU_SKINNING:
		{
			bool enable = g_SampleUI.GetCheckBox(IDC_CHECK_GPU_SKINNING)->GetChecked();
			g_character->setGpuSkinning(enable);
		}
		break;
	}
}
开发者ID:ColinGilbert,项目名称:grandpa-animation,代码行数:64,代码来源:Demo.cpp


注:本文中的CDXUTDialog::GetSlider方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。