Refreshed samples
This commit is contained in:
Родитель
85d411584d
Коммит
11acbb8bd3
Двоичные данные
PCSamples/Graphics/SimpleHDR_PC/Readme.docx
Двоичные данные
PCSamples/Graphics/SimpleHDR_PC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
PCSamples/IntroGraphics/DirectXTKSimpleSamplePC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/DirectXTKSimpleSamplePC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
PCSamples/IntroGraphics/SimpleBezierPC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/SimpleBezierPC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
PCSamples/IntroGraphics/SimpleComputePC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/SimpleComputePC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
PCSamples/IntroGraphics/SimpleInstancingPC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/SimpleInstancingPC/Readme.docx
Двоичный файл не отображается.
|
@ -191,9 +191,8 @@ void Sample::Update(DX::StepTimer const& timer)
|
|||
}
|
||||
|
||||
// Limit to avoid looking directly up or down
|
||||
float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, m_pitch);
|
||||
m_pitch = std::min(+limit, m_pitch);
|
||||
const float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, std::min(+limit, m_pitch));
|
||||
|
||||
if (m_yaw > XM_PI)
|
||||
{
|
||||
|
|
|
@ -210,9 +210,8 @@ void Sample::Update(DX::StepTimer const& timer)
|
|||
}
|
||||
|
||||
// Limit to avoid looking directly up or down
|
||||
float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, m_pitch);
|
||||
m_pitch = std::min(+limit, m_pitch);
|
||||
const float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, std::min(+limit, m_pitch));
|
||||
|
||||
if (m_yaw > XM_PI)
|
||||
{
|
||||
|
|
Двоичные данные
PCSamples/IntroGraphics/SimpleLightingPC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/SimpleLightingPC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
PCSamples/IntroGraphics/SimpleMSAA_PC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/SimpleMSAA_PC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
PCSamples/IntroGraphics/SimpleTexturePC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/SimpleTexturePC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
PCSamples/IntroGraphics/SimpleTrianglePC/Readme.docx
Двоичные данные
PCSamples/IntroGraphics/SimpleTrianglePC/Readme.docx
Двоичный файл не отображается.
Двоичные данные
UWPSamples/Audio/SimpleWASAPICaptureUWP/Readme.docx
Двоичные данные
UWPSamples/Audio/SimpleWASAPICaptureUWP/Readme.docx
Двоичный файл не отображается.
|
@ -29,6 +29,14 @@ Sample::Sample() :
|
|||
{
|
||||
m_deviceResources = std::make_unique<DX::DeviceResources>();
|
||||
m_deviceResources->RegisterDeviceNotify(this);
|
||||
|
||||
m_renderEventToken = MediaDevice::DefaultAudioRenderDeviceChanged +=
|
||||
ref new TypedEventHandler<Platform::Object^, DefaultAudioRenderDeviceChangedEventArgs^>([this](Platform::Object^ sender, Platform::Object^ args)
|
||||
{
|
||||
m_renderInterface = nullptr;
|
||||
m_renderInterface = Microsoft::WRL::Make<WASAPIRenderer>();
|
||||
m_renderInterface->InitializeAudioDeviceAsync();
|
||||
}, Platform::CallbackContext::Same);
|
||||
}
|
||||
|
||||
// Initialize the Direct3D resources required to run.
|
||||
|
@ -297,7 +305,14 @@ void Sample::Render()
|
|||
|
||||
// Draw the sample rates
|
||||
wchar_t rateString[32] = {};
|
||||
swprintf_s(rateString, L"Render rate: %dHz", m_renderInterface->GetMixFormat()->nSamplesPerSec);
|
||||
if (m_renderFormat != nullptr)
|
||||
{
|
||||
swprintf_s(rateString, L"Render rate: %dHz", m_renderFormat->nSamplesPerSec);
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(rateString, L"Render rate: -----Hz");
|
||||
}
|
||||
m_font->DrawString(m_spriteBatch.get(), rateString, pos, ATG::Colors::Orange);
|
||||
pos.y += spacing;
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@ private:
|
|||
Microsoft::WRL::ComPtr<WASAPIRenderer> m_renderInterface;
|
||||
std::vector<Windows::Devices::Enumeration::DeviceInformation^> m_captureDevices;
|
||||
Windows::Devices::Enumeration::DeviceWatcher^ m_captureWatcher;
|
||||
Platform::String^ m_currentId;
|
||||
Windows::Foundation::EventRegistrationToken m_renderEventToken;
|
||||
Platform::String^ m_currentId;
|
||||
std::unique_ptr<CBuffer> m_captureBuffer;
|
||||
WAVEFORMATEX* m_renderFormat;
|
||||
|
||||
|
|
Двоичные данные
UWPSamples/Audio/SimpleWASAPIPlaySoundUWP/Readme.docx
Двоичные данные
UWPSamples/Audio/SimpleWASAPIPlaySoundUWP/Readme.docx
Двоичный файл не отображается.
|
@ -11,11 +11,14 @@
|
|||
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::Media::Devices;
|
||||
using namespace Windows::Foundation;
|
||||
|
||||
WASAPIManager::WASAPIManager() :
|
||||
m_StateChangedEvent( nullptr ),
|
||||
m_Renderer( nullptr )
|
||||
{
|
||||
m_renderEventToken = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler<Platform::Object^, DefaultAudioRenderDeviceChangedEventArgs^>(this, &WASAPIManager::OnRenderDeviceChange);
|
||||
}
|
||||
|
||||
WASAPIManager::~WASAPIManager()
|
||||
|
@ -29,6 +32,13 @@ WASAPIManager::~WASAPIManager()
|
|||
}
|
||||
}
|
||||
|
||||
void WASAPIManager::OnRenderDeviceChange(Platform::Object^,
|
||||
Windows::Media::Devices::DefaultAudioRenderDeviceChangedEventArgs^)
|
||||
{
|
||||
RestartDevice();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: OnDeviceStateChange
|
||||
// Desc: Event callback from WASAPI renderer for changes in device state
|
||||
|
@ -180,6 +190,21 @@ void WASAPIManager::StartDevice()
|
|||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: RestartDevice
|
||||
// Desc: Restart playback
|
||||
//--------------------------------------------------------------------------------------
|
||||
void WASAPIManager::RestartDevice()
|
||||
{
|
||||
if (nullptr != m_Renderer)
|
||||
{
|
||||
StopDevice();
|
||||
m_Renderer = nullptr;
|
||||
}
|
||||
|
||||
InitializeDevice();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: StopDevice
|
||||
// Desc: Stop playback, if WASAPI renderer exists
|
||||
|
|
|
@ -20,7 +20,8 @@ public:
|
|||
WASAPIManager();
|
||||
|
||||
void StartDevice();
|
||||
void StopDevice();
|
||||
void RestartDevice();
|
||||
void StopDevice();
|
||||
void PauseDevice();
|
||||
void PlayPauseToggle();
|
||||
|
||||
|
@ -53,6 +54,9 @@ public:
|
|||
return bPlaying;
|
||||
}
|
||||
|
||||
void OnRenderDeviceChange(Platform::Object^,
|
||||
Windows::Media::Devices::DefaultAudioRenderDeviceChangedEventArgs^);
|
||||
|
||||
private:
|
||||
~WASAPIManager();
|
||||
|
||||
|
@ -64,4 +68,5 @@ private:
|
|||
|
||||
DeviceStateChangedEvent^ m_StateChangedEvent;
|
||||
Microsoft::WRL::ComPtr<WASAPIRenderer> m_Renderer;
|
||||
Windows::Foundation::EventRegistrationToken m_renderEventToken;
|
||||
};
|
||||
|
|
|
@ -193,9 +193,8 @@ void Sample::Update(DX::StepTimer const& timer)
|
|||
}
|
||||
|
||||
// Limit to avoid looking directly up or down
|
||||
float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, m_pitch);
|
||||
m_pitch = std::min(+limit, m_pitch);
|
||||
const float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, std::min(+limit, m_pitch));
|
||||
|
||||
if (m_yaw > XM_PI)
|
||||
{
|
||||
|
|
|
@ -202,9 +202,8 @@ void Sample::Update(DX::StepTimer const& timer)
|
|||
}
|
||||
|
||||
// Limit to avoid looking directly up or down
|
||||
float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, m_pitch);
|
||||
m_pitch = std::min(+limit, m_pitch);
|
||||
const float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, std::min(+limit, m_pitch));
|
||||
|
||||
if (m_yaw > XM_PI)
|
||||
{
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -131,7 +131,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -154,7 +154,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -178,7 +178,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -202,7 +202,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -225,7 +225,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -131,7 +131,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -154,7 +154,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -178,7 +178,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -202,7 +202,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -225,7 +225,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -126,7 +126,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -149,7 +149,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -173,7 +173,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -197,7 +197,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
@ -220,7 +220,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ATGTelemetryUWP.lib; d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; ole32.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Kits\Telemetry\$(Platform); %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
|
|
@ -380,9 +380,8 @@ void Sample::UpdateCamera( Vector3 movement )
|
|||
m_yaw += rotationDelta.x;
|
||||
|
||||
// Limit to avoid looking directly up or down
|
||||
float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max( -limit, m_pitch );
|
||||
m_pitch = std::min( +limit, m_pitch );
|
||||
const float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, std::min(+limit, m_pitch));
|
||||
|
||||
if ( m_yaw > XM_PI )
|
||||
{
|
||||
|
|
Двоичные данные
XDKSamples/Audio/SimpleWASAPICaptureXDK/Readme.docx
Двоичные данные
XDKSamples/Audio/SimpleWASAPICaptureXDK/Readme.docx
Двоичный файл не отображается.
|
@ -12,6 +12,8 @@
|
|||
#include "WASAPIManager.h"
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::Media::Devices;
|
||||
using namespace Windows::Foundation;
|
||||
|
||||
WASAPIManager::WASAPIManager() :
|
||||
m_RenderStateChangedEvent( nullptr ),
|
||||
|
@ -26,6 +28,8 @@ WASAPIManager::WASAPIManager() :
|
|||
//Create a 32k buffer
|
||||
m_captureBuffer = new CBuffer(32768);
|
||||
|
||||
m_renderEventToken = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler<Platform::Object^, DefaultAudioRenderDeviceChangedEventArgs^>(this, &WASAPIManager::OnRenderDeviceChange);
|
||||
|
||||
InitializeCriticalSectionEx(&m_CritSec, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -54,6 +58,11 @@ WASAPIManager::~WASAPIManager()
|
|||
DeleteCriticalSection( &m_CritSec );
|
||||
}
|
||||
|
||||
void WASAPIManager::OnRenderDeviceChange(Platform::Object^,
|
||||
Windows::Media::Devices::DefaultAudioRenderDeviceChangedEventArgs^)
|
||||
{
|
||||
RestartDevice();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: OnDeviceStateChange
|
||||
|
@ -319,6 +328,15 @@ void WASAPIManager::StartDevice()
|
|||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: RestartDevice
|
||||
// Desc: Restart playback
|
||||
//--------------------------------------------------------------------------------------
|
||||
void WASAPIManager::RestartDevice()
|
||||
{
|
||||
m_Renderer = nullptr;
|
||||
InitializeRenderDevice();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: GetStatus
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
WASAPIManager();
|
||||
|
||||
void StartDevice();
|
||||
void RestartDevice();
|
||||
void PlayPauseToggle();
|
||||
|
||||
void RecordToggle();
|
||||
|
@ -43,6 +44,9 @@ public:
|
|||
|
||||
void UpdateStatus();
|
||||
|
||||
void OnRenderDeviceChange(Platform::Object^,
|
||||
Windows::Media::Devices::DefaultAudioRenderDeviceChangedEventArgs^);
|
||||
|
||||
internal:
|
||||
void GetStatus(ManagerStatus *inStatus);
|
||||
|
||||
|
@ -75,6 +79,7 @@ private:
|
|||
DeviceStateChangedEvent^ m_CaptureStateChangedEvent;
|
||||
Microsoft::WRL::ComPtr<WASAPIRenderer> m_Renderer;
|
||||
Microsoft::WRL::ComPtr<WASAPICapture> m_Capture;
|
||||
Windows::Foundation::EventRegistrationToken m_renderEventToken;
|
||||
|
||||
DeviceManager m_deviceManager;
|
||||
|
||||
|
|
Двоичные данные
XDKSamples/Audio/SimpleWASAPIPlaySoundXDK/Readme.docx
Двоичные данные
XDKSamples/Audio/SimpleWASAPIPlaySoundXDK/Readme.docx
Двоичный файл не отображается.
|
@ -48,7 +48,6 @@ void Sample::Initialize(IUnknown* window)
|
|||
{
|
||||
DX::ThrowIfFailed(hr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma region Frame Update
|
||||
|
|
|
@ -9,13 +9,15 @@
|
|||
#include "pch.h"
|
||||
#include "WASAPIManager.h"
|
||||
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::Media::Devices;
|
||||
using namespace Windows::Foundation;
|
||||
|
||||
WASAPIManager::WASAPIManager() :
|
||||
m_StateChangedEvent( nullptr ),
|
||||
m_Renderer( nullptr )
|
||||
{
|
||||
m_renderEventToken = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler<Platform::Object^, DefaultAudioRenderDeviceChangedEventArgs^>(this, &WASAPIManager::OnRenderDeviceChange);
|
||||
}
|
||||
|
||||
WASAPIManager::~WASAPIManager()
|
||||
|
@ -29,6 +31,12 @@ WASAPIManager::~WASAPIManager()
|
|||
}
|
||||
}
|
||||
|
||||
void WASAPIManager::OnRenderDeviceChange(Platform::Object^,
|
||||
Windows::Media::Devices::DefaultAudioRenderDeviceChangedEventArgs^)
|
||||
{
|
||||
RestartDevice();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: OnDeviceStateChange
|
||||
// Desc: Event callback from WASAPI renderer for changes in device state
|
||||
|
@ -162,6 +170,21 @@ void WASAPIManager::StartDevice()
|
|||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: RestartDevice
|
||||
// Desc: Restart playback
|
||||
//--------------------------------------------------------------------------------------
|
||||
void WASAPIManager::RestartDevice()
|
||||
{
|
||||
if (nullptr != m_Renderer)
|
||||
{
|
||||
StopDevice();
|
||||
m_Renderer = nullptr;
|
||||
}
|
||||
|
||||
InitializeDevice();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: StopDevice
|
||||
// Desc: Stop playback, if WASAPI renderer exists
|
||||
|
|
|
@ -17,7 +17,8 @@ public:
|
|||
WASAPIManager();
|
||||
|
||||
void StartDevice();
|
||||
void StopDevice();
|
||||
void RestartDevice();
|
||||
void StopDevice();
|
||||
void PauseDevice();
|
||||
void PlayPauseToggle();
|
||||
|
||||
|
@ -48,6 +49,9 @@ public:
|
|||
return bPlaying;
|
||||
}
|
||||
|
||||
void OnRenderDeviceChange(Platform::Object^,
|
||||
Windows::Media::Devices::DefaultAudioRenderDeviceChangedEventArgs^);
|
||||
|
||||
private:
|
||||
~WASAPIManager();
|
||||
|
||||
|
@ -59,4 +63,5 @@ private:
|
|||
|
||||
DeviceStateChangedEvent^ m_StateChangedEvent;
|
||||
Microsoft::WRL::ComPtr<WASAPIRenderer> m_Renderer;
|
||||
Windows::Foundation::EventRegistrationToken m_renderEventToken;
|
||||
};
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// Camera.cpp
|
||||
//
|
||||
// Advanced Technology Group (ATG)
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#include "pch.h"
|
||||
#include "Camera.h"
|
||||
|
||||
using namespace ATG;
|
||||
using namespace DirectX;
|
||||
|
||||
Camera::Camera()
|
||||
: m_lookat(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
, m_theta(0.0f)
|
||||
, m_phi(XM_2PI / 6.0f)
|
||||
, m_radius(3.3f)
|
||||
, m_rotateRate(XM_PI)
|
||||
, m_moveRate(5.0f)
|
||||
, m_minRadius(1.0f)
|
||||
, m_maxRadius(10.0f)
|
||||
, m_near(0.05f)
|
||||
, m_far(100.0f)
|
||||
, m_aspect(16.0f/9.0f)
|
||||
{ }
|
||||
|
||||
Camera::Camera(float theta, float phi, float distance, float znear, float zfar, float aspect)
|
||||
: m_theta(theta)
|
||||
, m_phi(phi)
|
||||
, m_radius(distance)
|
||||
, m_near(znear)
|
||||
, m_far(zfar)
|
||||
, m_aspect(aspect)
|
||||
{ }
|
||||
|
||||
void Camera::SetPerspective(float aspect, float znear, float zfar)
|
||||
{
|
||||
m_aspect = aspect;
|
||||
m_near = znear;
|
||||
m_far = zfar;
|
||||
}
|
||||
|
||||
void Camera::SetAspect(float aspect)
|
||||
{
|
||||
m_aspect = aspect;
|
||||
}
|
||||
|
||||
void Camera::SetLookAt(DirectX::XMVECTOR point)
|
||||
{
|
||||
XMStoreFloat4(&m_lookat, point);
|
||||
}
|
||||
|
||||
void Camera::SetMoveRate(float rate)
|
||||
{
|
||||
m_moveRate = std::max(0.1f, rate);
|
||||
}
|
||||
|
||||
void Camera::SetRotateRate(float rate)
|
||||
{
|
||||
m_rotateRate = std::max(0.1f, rate);
|
||||
}
|
||||
|
||||
void Camera::SetRadialConstraints(float minRadius, float maxRadius)
|
||||
{
|
||||
m_minRadius = std::max(1e-2f, minRadius);
|
||||
m_maxRadius = std::max(m_minRadius, maxRadius);
|
||||
}
|
||||
|
||||
void Camera::Update(float deltaTime, const DirectX::GamePad::State& pad)
|
||||
{
|
||||
m_theta += pad.thumbSticks.rightX * m_rotateRate * deltaTime;
|
||||
m_phi = std::max(1e-2f, std::min(XM_PIDIV2, m_phi - pad.thumbSticks.rightY * m_rotateRate * deltaTime));
|
||||
m_radius = std::max(m_minRadius, std::min(m_maxRadius, m_radius - pad.thumbSticks.leftY * m_moveRate * deltaTime));
|
||||
}
|
||||
|
||||
void Camera::Update(float deltaTime, const DirectX::Mouse& mouse, DirectX::Keyboard& kb)
|
||||
{
|
||||
Keyboard::State kbState = kb.GetState();
|
||||
Mouse::State mouseState = mouse.GetState();
|
||||
|
||||
float deltaTheta = -1.0f * float(kbState.A) + 1.0f * float(kbState.D);
|
||||
float deltaPhi = -1.0f * float(kbState.S) + 1.0f * float(kbState.W);
|
||||
float deltaRadius = mouseState.scrollWheelValue < 0 ? -1.0f : mouseState.scrollWheelValue > 0 ? 1.0f : 0.0f;
|
||||
|
||||
m_theta += deltaTheta * m_rotateRate * deltaTime;
|
||||
m_phi = std::max(1e-2f, std::min(XM_PIDIV2, m_phi - deltaPhi * m_rotateRate * deltaTime));
|
||||
m_radius = std::max(m_minRadius, std::min(m_maxRadius, m_radius - deltaRadius * m_moveRate * deltaTime));
|
||||
}
|
||||
|
||||
DirectX::XMMATRIX Camera::GetView() const
|
||||
{
|
||||
DirectX::XMVECTOR pos = XMVectorSet(
|
||||
m_radius * sinf(m_phi) * cosf(m_theta),
|
||||
m_radius * cosf(m_phi),
|
||||
m_radius * sinf(m_phi) * sinf(m_theta),
|
||||
0);
|
||||
|
||||
return XMMatrixLookAtLH(pos, XMLoadFloat4(&m_lookat), XMVectorSet(0, 1, 0, 0));
|
||||
}
|
||||
|
||||
DirectX::XMMATRIX Camera::GetProjection() const
|
||||
{
|
||||
return XMMatrixPerspectiveFovLH(XM_PIDIV4, m_aspect, m_near, m_far);
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// Camera.h
|
||||
//
|
||||
// Advanced Technology Group (ATG)
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <GamePad.h>
|
||||
#include <Keyboard.h>
|
||||
#include <Mouse.h>
|
||||
|
||||
namespace ATG
|
||||
{
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
Camera();
|
||||
Camera(
|
||||
float theta,
|
||||
float phi,
|
||||
float distance,
|
||||
float znear,
|
||||
float zfar,
|
||||
float aspect);
|
||||
|
||||
Camera(const Camera&) = default;
|
||||
Camera& operator=(const Camera&) = default;
|
||||
|
||||
Camera(Camera&&) = default;
|
||||
Camera& operator=(Camera&&) = default;
|
||||
|
||||
~Camera() = default;
|
||||
|
||||
void XM_CALLCONV SetLookAt(DirectX::XMVECTOR point);
|
||||
|
||||
void SetMoveRate(float rate);
|
||||
void SetRotateRate(float rate);
|
||||
|
||||
void SetRadialConstraints(float minRadius, float maxRadius);
|
||||
|
||||
void SetPerspective(float aspect, float znear, float zfar);
|
||||
void SetAspect(float aspect);
|
||||
|
||||
void Update(float deltaTime, const DirectX::GamePad::State& pad);
|
||||
void Update(float deltaTime, const DirectX::Mouse& mouse, DirectX::Keyboard& kb);
|
||||
|
||||
DirectX::XMMATRIX XM_CALLCONV GetView() const;
|
||||
DirectX::XMMATRIX XM_CALLCONV GetProjection() const;
|
||||
|
||||
private:
|
||||
// Orientation
|
||||
DirectX::XMFLOAT4 m_lookat;
|
||||
|
||||
// Position
|
||||
float m_theta;
|
||||
float m_phi;
|
||||
float m_radius;
|
||||
|
||||
// Movement
|
||||
float m_rotateRate;
|
||||
float m_moveRate;
|
||||
|
||||
// Constraints
|
||||
float m_minRadius;
|
||||
float m_maxRadius;
|
||||
|
||||
// Projection
|
||||
float m_near;
|
||||
float m_far;
|
||||
float m_aspect;
|
||||
};
|
||||
}
|
Двоичные данные
XDKSamples/Graphics/SimpleESRAM/ReadMe.docx
Двоичные данные
XDKSamples/Graphics/SimpleESRAM/ReadMe.docx
Двоичный файл не отображается.
|
@ -30,6 +30,9 @@ namespace
|
|||
//--------------------------------------
|
||||
// Constants
|
||||
|
||||
const float c_defaultPhi = XM_2PI / 6.0f;
|
||||
const float c_defaultRadius = 3.3f;
|
||||
|
||||
// Assest paths.
|
||||
const wchar_t* s_modelPaths[] =
|
||||
{
|
||||
|
@ -394,7 +397,13 @@ namespace
|
|||
|
||||
|
||||
Sample::Sample()
|
||||
: m_generator(std::random_device()())
|
||||
: m_displayWidth(0)
|
||||
, m_displayHeight(0)
|
||||
, m_frame(0)
|
||||
, m_theta(0.f)
|
||||
, m_phi(c_defaultPhi)
|
||||
, m_radius(c_defaultRadius)
|
||||
, m_generator(std::random_device()())
|
||||
, m_showOverlay(SupportsESRAM())
|
||||
, m_mapScheme(SupportsESRAM() ? EMS_Simple : EMS_None)
|
||||
{
|
||||
|
@ -560,14 +569,45 @@ void Sample::Update(const DX::StepTimer& timer)
|
|||
{
|
||||
UpdateResourceMappings();
|
||||
}
|
||||
|
||||
if (pad.IsRightStickPressed())
|
||||
{
|
||||
m_theta = 0.f;
|
||||
m_phi = c_defaultPhi;
|
||||
m_radius = c_defaultRadius;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_theta += pad.thumbSticks.rightX * XM_PI * elapsedTime;
|
||||
m_phi -= pad.thumbSticks.rightY * XM_PI * elapsedTime;
|
||||
m_radius -= pad.thumbSticks.leftY * 5.f * elapsedTime;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gamePadButtons.Reset();
|
||||
}
|
||||
|
||||
// Update the scene.
|
||||
m_camera.Update(elapsedTime, pad);
|
||||
// Limit to avoid looking directly up or down
|
||||
m_phi = std::max(1e-2f, std::min(XM_PIDIV2, m_phi));
|
||||
m_radius = std::max(1.f, std::min(10.f, m_radius));
|
||||
|
||||
if (m_theta > XM_PI)
|
||||
{
|
||||
m_theta -= XM_PI * 2.f;
|
||||
}
|
||||
else if (m_theta < -XM_PI)
|
||||
{
|
||||
m_theta += XM_PI * 2.f;
|
||||
}
|
||||
|
||||
XMVECTOR lookFrom = XMVectorSet(
|
||||
m_radius * sinf(m_phi) * cosf(m_theta),
|
||||
m_radius * cosf(m_phi),
|
||||
m_radius * sinf(m_phi) * sinf(m_theta),
|
||||
0);
|
||||
|
||||
m_view = XMMatrixLookAtLH(lookFrom, g_XMZero, g_XMIdentityR1);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
@ -626,7 +666,7 @@ void Sample::Render()
|
|||
// Draw the scene.
|
||||
for (auto& obj : m_scene)
|
||||
{
|
||||
obj.model->Draw(context, *m_commonStates, obj.world, m_camera.GetView(), m_camera.GetProjection());
|
||||
obj.model->Draw(context, *m_commonStates, obj.world, m_view, m_proj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,11 +768,11 @@ void Sample::Render()
|
|||
const wchar_t* commonCtrl = nullptr;
|
||||
if (SupportsESRAM())
|
||||
{
|
||||
commonCtrl = L"[RThumb]/[LThumb]: Move Camera [DPad] Switch Mapping Schemes [A] Toggle Overlay [View] Exit ";
|
||||
commonCtrl = L"[LThumb] Toward/Away [RThumb]: Orbit Camera [DPad] Switch Mapping Schemes [A] Toggle Overlay [View] Exit ";
|
||||
}
|
||||
else
|
||||
{
|
||||
commonCtrl = L"[RThumb]/[LThumb]: Move Camera [View] Exit ";
|
||||
commonCtrl = L"[LThumb] Toward/Away [RThumb]: Orbit Camera [View] Exit ";
|
||||
}
|
||||
|
||||
DX::DrawControllerString(m_hudBatch.get(), m_smallFont.get(), m_ctrlFont.get(), commonCtrl, textPos, textColor);
|
||||
|
@ -863,7 +903,7 @@ void Sample::CreateWindowSizeDependentResources()
|
|||
m_hudBatch->SetViewport(m_deviceResources->GetScreenViewport());
|
||||
|
||||
// Set camera parameters.
|
||||
m_camera.SetAspect(float(m_displayWidth) / float(m_displayHeight));
|
||||
m_proj = XMMatrixPerspectiveFovLH(XM_PIDIV4, float(m_displayWidth) / float(m_displayHeight), 0.1f, 500.0f);
|
||||
|
||||
// Begin uploading texture resources
|
||||
m_smallFont = std::make_unique<SpriteFont>(device, L"SegoeUI_18.spritefont");
|
||||
|
@ -1129,7 +1169,7 @@ void Sample::UpdateResourceMappings()
|
|||
// 'Random' mapping performs a random check over each page against a user-specified
|
||||
// probability to determine whether that page will be mapped to system or ESRAM memory.
|
||||
//
|
||||
// There<EFBFBD>s not a specific benefit to this mapping scheme <20> it simply shows off how to utilize
|
||||
// There's not a specific benefit to this mapping scheme -- simply shows off how to utilize
|
||||
// the provided API in a unique fashion.
|
||||
//
|
||||
// This mapping method also makes use of the XGMemoryLayout::MapRunLengthArray(...) function.
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include "DeviceResources.h"
|
||||
#include "StepTimer.h"
|
||||
|
||||
#include "Camera.h"
|
||||
|
||||
constexpr int PlaneCount = _countof(XG_RESOURCE_LAYOUT::Plane);
|
||||
|
||||
|
||||
|
@ -85,19 +83,18 @@ private:
|
|||
private:
|
||||
// Device resources.
|
||||
std::unique_ptr<DX::DeviceResources> m_deviceResources;
|
||||
int m_displayWidth = 0;
|
||||
int m_displayHeight = 0;
|
||||
int m_displayWidth;
|
||||
int m_displayHeight;
|
||||
|
||||
// Rendering loop timer.
|
||||
uint64_t m_frame = 0;
|
||||
uint64_t m_frame;
|
||||
DX::StepTimer m_timer;
|
||||
std::unique_ptr<DX::GPUTimer> m_profiler;
|
||||
|
||||
// Input devices.
|
||||
DirectX::GamePad m_gamePad;
|
||||
DirectX::GamePad::ButtonStateTracker m_gamePadButtons;
|
||||
ATG::Camera m_camera;
|
||||
|
||||
|
||||
// DirectXTK objects.
|
||||
std::unique_ptr<DirectX::GraphicsMemory> m_graphicsMemory;
|
||||
std::unique_ptr<DirectX::CommonStates> m_commonStates;
|
||||
|
@ -107,6 +104,13 @@ private:
|
|||
std::unique_ptr<DirectX::SpriteBatch> m_hudBatch;
|
||||
std::unique_ptr<DirectX::SpriteFont> m_smallFont;
|
||||
std::unique_ptr<DirectX::SpriteFont> m_ctrlFont;
|
||||
|
||||
// Camera
|
||||
float m_theta;
|
||||
float m_phi;
|
||||
float m_radius;
|
||||
DirectX::SimpleMath::Matrix m_proj;
|
||||
DirectX::SimpleMath::Matrix m_view;
|
||||
|
||||
// Assets & Scene
|
||||
std::vector<std::unique_ptr<DirectX::Model>> m_models;
|
||||
|
|
|
@ -169,7 +169,6 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\Kits\ATGTK\ControllerFont.h" />
|
||||
<ClInclude Include="..\..\..\Kits\ATGTK\PerformanceTimersXbox.h" />
|
||||
<ClInclude Include="Camera.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="PIXHelpers.h" />
|
||||
<ClInclude Include="SimpleESRAM.h" />
|
||||
|
@ -180,7 +179,6 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\Kits\ATGTK\PerformanceTimersXbox.cpp" />
|
||||
<ClCompile Include="Camera.cpp" />
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="DeviceResources.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h">
|
||||
<Filter>ATG Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Camera.h" />
|
||||
<ClInclude Include="SimpleESRAM.h" />
|
||||
<ClInclude Include="..\..\..\Kits\ATGTK\ControllerFont.h">
|
||||
<Filter>ATG Tool Kit</Filter>
|
||||
|
@ -53,7 +52,6 @@
|
|||
<ClCompile Include="DeviceResources.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Camera.cpp" />
|
||||
<ClCompile Include="SimpleESRAM.cpp" />
|
||||
<ClCompile Include="..\..\..\Kits\ATGTK\PerformanceTimersXbox.cpp">
|
||||
<Filter>ATG Tool Kit</Filter>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <stdexcept>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pix.h>
|
||||
#include <xgmemory.h>
|
||||
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// Camera.cpp
|
||||
//
|
||||
// Advanced Technology Group (ATG)
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#include "pch.h"
|
||||
#include "Camera.h"
|
||||
|
||||
using namespace ATG;
|
||||
using namespace DirectX;
|
||||
|
||||
Camera::Camera()
|
||||
: m_lookat(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
, m_theta(0.0f)
|
||||
, m_phi(XM_2PI / 6.0f)
|
||||
, m_radius(3.3f)
|
||||
, m_rotateRate(XM_PI)
|
||||
, m_moveRate(5.0f)
|
||||
, m_minRadius(1.0f)
|
||||
, m_maxRadius(10.0f)
|
||||
, m_near(0.05f)
|
||||
, m_far(100.0f)
|
||||
, m_aspect(16.0f/9.0f)
|
||||
{ }
|
||||
|
||||
Camera::Camera(float theta, float phi, float distance, float znear, float zfar, float aspect)
|
||||
: m_theta(theta)
|
||||
, m_phi(phi)
|
||||
, m_radius(distance)
|
||||
, m_near(znear)
|
||||
, m_far(zfar)
|
||||
, m_aspect(aspect)
|
||||
{ }
|
||||
|
||||
void Camera::SetPerspective(float aspect, float znear, float zfar)
|
||||
{
|
||||
m_aspect = aspect;
|
||||
m_near = znear;
|
||||
m_far = zfar;
|
||||
}
|
||||
|
||||
void Camera::SetAspect(float aspect)
|
||||
{
|
||||
m_aspect = aspect;
|
||||
}
|
||||
|
||||
void Camera::SetLookAt(DirectX::XMVECTOR point)
|
||||
{
|
||||
XMStoreFloat4(&m_lookat, point);
|
||||
}
|
||||
|
||||
void Camera::SetMoveRate(float rate)
|
||||
{
|
||||
m_moveRate = std::max(0.1f, rate);
|
||||
}
|
||||
|
||||
void Camera::SetRotateRate(float rate)
|
||||
{
|
||||
m_rotateRate = std::max(0.1f, rate);
|
||||
}
|
||||
|
||||
void Camera::SetRadialConstraints(float minRadius, float maxRadius)
|
||||
{
|
||||
m_minRadius = std::max(1e-2f, minRadius);
|
||||
m_maxRadius = std::max(m_minRadius, maxRadius);
|
||||
}
|
||||
|
||||
void Camera::Update(float deltaTime, const DirectX::GamePad::State& pad)
|
||||
{
|
||||
m_theta += pad.thumbSticks.rightX * m_rotateRate * deltaTime;
|
||||
m_phi = std::max(1e-2f, std::min(XM_PIDIV2, m_phi - pad.thumbSticks.rightY * m_rotateRate * deltaTime));
|
||||
m_radius = std::max(m_minRadius, std::min(m_maxRadius, m_radius - pad.thumbSticks.leftY * m_moveRate * deltaTime));
|
||||
}
|
||||
|
||||
void Camera::Update(float deltaTime, const DirectX::Mouse& mouse, DirectX::Keyboard& kb)
|
||||
{
|
||||
Keyboard::State kbState = kb.GetState();
|
||||
Mouse::State mouseState = mouse.GetState();
|
||||
|
||||
float deltaTheta = -1.0f * float(kbState.A) + 1.0f * float(kbState.D);
|
||||
float deltaPhi = -1.0f * float(kbState.S) + 1.0f * float(kbState.W);
|
||||
float deltaRadius = mouseState.scrollWheelValue < 0 ? -1.0f : mouseState.scrollWheelValue > 0 ? 1.0f : 0.0f;
|
||||
|
||||
m_theta += deltaTheta * m_rotateRate * deltaTime;
|
||||
m_phi = std::max(1e-2f, std::min(XM_PIDIV2, m_phi - deltaPhi * m_rotateRate * deltaTime));
|
||||
m_radius = std::max(m_minRadius, std::min(m_maxRadius, m_radius - deltaRadius * m_moveRate * deltaTime));
|
||||
}
|
||||
|
||||
DirectX::XMMATRIX Camera::GetView() const
|
||||
{
|
||||
DirectX::XMVECTOR pos = XMVectorSet(
|
||||
m_radius * sinf(m_phi) * cosf(m_theta),
|
||||
m_radius * cosf(m_phi),
|
||||
m_radius * sinf(m_phi) * sinf(m_theta),
|
||||
0);
|
||||
|
||||
return XMMatrixLookAtLH(pos, XMLoadFloat4(&m_lookat), XMVectorSet(0, 1, 0, 0));
|
||||
}
|
||||
|
||||
DirectX::XMMATRIX Camera::GetProjection() const
|
||||
{
|
||||
return XMMatrixPerspectiveFovLH(XM_PIDIV4, m_aspect, m_near, m_far);
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// Camera.h
|
||||
//
|
||||
// Advanced Technology Group (ATG)
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <GamePad.h>
|
||||
#include <Keyboard.h>
|
||||
#include <Mouse.h>
|
||||
|
||||
namespace ATG
|
||||
{
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
Camera();
|
||||
Camera(
|
||||
float theta,
|
||||
float phi,
|
||||
float distance,
|
||||
float znear,
|
||||
float zfar,
|
||||
float aspect);
|
||||
|
||||
Camera(const Camera&) = default;
|
||||
Camera& operator=(const Camera&) = default;
|
||||
|
||||
Camera(Camera&&) = default;
|
||||
Camera& operator=(Camera&&) = default;
|
||||
|
||||
~Camera() = default;
|
||||
|
||||
void XM_CALLCONV SetLookAt(DirectX::XMVECTOR point);
|
||||
|
||||
void SetMoveRate(float rate);
|
||||
void SetRotateRate(float rate);
|
||||
|
||||
void SetRadialConstraints(float minRadius, float maxRadius);
|
||||
|
||||
void SetPerspective(float aspect, float znear, float zfar);
|
||||
void SetAspect(float aspect);
|
||||
|
||||
void Update(float deltaTime, const DirectX::GamePad::State& pad);
|
||||
void Update(float deltaTime, const DirectX::Mouse& mouse, DirectX::Keyboard& kb);
|
||||
|
||||
DirectX::XMMATRIX XM_CALLCONV GetView() const;
|
||||
DirectX::XMMATRIX XM_CALLCONV GetProjection() const;
|
||||
|
||||
private:
|
||||
// Orientation
|
||||
DirectX::XMFLOAT4 m_lookat;
|
||||
|
||||
// Position
|
||||
float m_theta;
|
||||
float m_phi;
|
||||
float m_radius;
|
||||
|
||||
// Movement
|
||||
float m_rotateRate;
|
||||
float m_moveRate;
|
||||
|
||||
// Constraints
|
||||
float m_minRadius;
|
||||
float m_maxRadius;
|
||||
|
||||
// Projection
|
||||
float m_near;
|
||||
float m_far;
|
||||
float m_aspect;
|
||||
};
|
||||
}
|
Двоичные данные
XDKSamples/Graphics/SimpleESRAM12/ReadMe.docx
Двоичные данные
XDKSamples/Graphics/SimpleESRAM12/ReadMe.docx
Двоичный файл не отображается.
|
@ -8,8 +8,6 @@
|
|||
#include "pch.h"
|
||||
#include "SimpleESRAM12.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
extern void ExitSample();
|
||||
|
||||
using namespace DirectX;
|
||||
|
@ -52,6 +50,9 @@ namespace
|
|||
//--------------------------------------
|
||||
// Constants
|
||||
|
||||
const float c_defaultPhi = XM_2PI / 6.0f;
|
||||
const float c_defaultRadius = 3.3f;
|
||||
|
||||
// Assest paths.
|
||||
const wchar_t* s_modelPaths[] =
|
||||
{
|
||||
|
@ -395,7 +396,13 @@ namespace
|
|||
|
||||
|
||||
Sample::Sample()
|
||||
: m_generator(std::random_device()())
|
||||
: m_displayWidth(0)
|
||||
, m_displayHeight(0)
|
||||
, m_frame(0)
|
||||
, m_theta(0.f)
|
||||
, m_phi(c_defaultPhi)
|
||||
, m_radius(c_defaultRadius)
|
||||
, m_generator(std::random_device()())
|
||||
, m_showOverlay(SupportsESRAM())
|
||||
, m_mapScheme(SupportsESRAM() ? EMS_Simple : EMS_None)
|
||||
{
|
||||
|
@ -561,18 +568,50 @@ void Sample::Update(const DX::StepTimer& timer)
|
|||
{
|
||||
UpdateResourceMappings();
|
||||
}
|
||||
|
||||
if (pad.IsRightStickPressed())
|
||||
{
|
||||
m_theta = 0.f;
|
||||
m_phi = c_defaultPhi;
|
||||
m_radius = c_defaultRadius;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_theta += pad.thumbSticks.rightX * XM_PI * elapsedTime;
|
||||
m_phi -= pad.thumbSticks.rightY * XM_PI * elapsedTime;
|
||||
m_radius -= pad.thumbSticks.leftY * 5.f * elapsedTime;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gamePadButtons.Reset();
|
||||
}
|
||||
|
||||
// Update the scene.
|
||||
m_camera.Update(elapsedTime, pad);
|
||||
// Limit to avoid looking directly up or down
|
||||
m_phi = std::max(1e-2f, std::min(XM_PIDIV2, m_phi));
|
||||
m_radius = std::max(1.f, std::min(10.f, m_radius));
|
||||
|
||||
if (m_theta > XM_PI)
|
||||
{
|
||||
m_theta -= XM_PI * 2.f;
|
||||
}
|
||||
else if (m_theta < -XM_PI)
|
||||
{
|
||||
m_theta += XM_PI * 2.f;
|
||||
}
|
||||
|
||||
XMVECTOR lookFrom = XMVectorSet(
|
||||
m_radius * sinf(m_phi) * cosf(m_theta),
|
||||
m_radius * cosf(m_phi),
|
||||
m_radius * sinf(m_phi) * sinf(m_theta),
|
||||
0);
|
||||
|
||||
m_view = XMMatrixLookAtLH(lookFrom, g_XMZero, g_XMIdentityR1);
|
||||
|
||||
// Update the scene.
|
||||
for (auto& obj : m_scene)
|
||||
{
|
||||
Model::UpdateEffectMatrices(obj.effects, obj.world, m_camera.GetView(), m_camera.GetProjection());
|
||||
Model::UpdateEffectMatrices(obj.effects, obj.world, m_view, m_proj);
|
||||
}
|
||||
|
||||
PIXEndEvent();
|
||||
|
@ -757,11 +796,11 @@ void Sample::Render()
|
|||
const wchar_t* commonCtrl = nullptr;
|
||||
if (SupportsESRAM())
|
||||
{
|
||||
commonCtrl = L"[RThumb]/[LThumb]: Move Camera [DPad] Switch Mapping Schemes [A] Toggle Overlay [View] Exit ";
|
||||
commonCtrl = L"[LThumb] Toward/Away [RThumb]: Orbit Camera [DPad] Switch Mapping Schemes [A] Toggle Overlay [View] Exit ";
|
||||
}
|
||||
else
|
||||
{
|
||||
commonCtrl = L"[RThumb]/[LThumb]: Move Camera [View] Exit ";
|
||||
commonCtrl = L"[LThumb] Toward/Away [RThumb]: Orbit Camera [View] Exit ";
|
||||
}
|
||||
|
||||
DX::DrawControllerString(m_hudBatch.get(), m_smallFont.get(), m_ctrlFont.get(), commonCtrl, textPos, textColor);
|
||||
|
@ -966,7 +1005,7 @@ void Sample::CreateWindowSizeDependentResources()
|
|||
m_hudBatch->SetViewport(m_deviceResources->GetScreenViewport());
|
||||
|
||||
// Set camera parameters.
|
||||
m_camera.SetAspect(float(m_displayWidth) / float(m_displayHeight));
|
||||
m_proj = XMMatrixPerspectiveFovLH(XM_PIDIV4, float(size.right) / float(size.bottom), 0.1f, 500.0f);
|
||||
|
||||
// Begin uploading texture resources
|
||||
{
|
||||
|
@ -1238,7 +1277,7 @@ void Sample::UpdateResourceMappings()
|
|||
// 'Random' mapping performs a random check over each page against a user-specified
|
||||
// probability to determine whether that page will be mapped to system or ESRAM memory.
|
||||
//
|
||||
// There<EFBFBD>s not a specific benefit to this mapping scheme <20> it simply shows off how to utilize
|
||||
// There's not a specific benefit to this mapping scheme -- it simply shows off how to utilize
|
||||
// the provided API in a unique fashion.
|
||||
//
|
||||
// This mapping method also makes use of the XGMemoryLayout::MapRunLengthArray(...) function.
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include "DeviceResources.h"
|
||||
#include "StepTimer.h"
|
||||
|
||||
#include "Camera.h"
|
||||
|
||||
constexpr int PlaneCount = _countof(XG_RESOURCE_LAYOUT::Plane);
|
||||
|
||||
|
||||
|
@ -88,18 +86,17 @@ private:
|
|||
private:
|
||||
// Device resources.
|
||||
std::unique_ptr<DX::DeviceResources> m_deviceResources;
|
||||
int m_displayWidth = 0;
|
||||
int m_displayHeight = 0;
|
||||
int m_displayWidth;
|
||||
int m_displayHeight;
|
||||
|
||||
// Rendering loop timer.
|
||||
uint64_t m_frame = 0;
|
||||
uint64_t m_frame;
|
||||
DX::StepTimer m_timer;
|
||||
std::unique_ptr<DX::GPUTimer> m_profiler;
|
||||
|
||||
// Input devices.
|
||||
DirectX::GamePad m_gamePad;
|
||||
DirectX::GamePad::ButtonStateTracker m_gamePadButtons;
|
||||
ATG::Camera m_camera;
|
||||
|
||||
// DirectXTK objects.
|
||||
std::unique_ptr<DirectX::GraphicsMemory> m_graphicsMemory;
|
||||
|
@ -112,7 +109,14 @@ private:
|
|||
std::unique_ptr<DirectX::SpriteBatch> m_hudBatch;
|
||||
std::unique_ptr<DirectX::SpriteFont> m_smallFont;
|
||||
std::unique_ptr<DirectX::SpriteFont> m_ctrlFont;
|
||||
|
||||
|
||||
// Camera
|
||||
float m_theta;
|
||||
float m_phi;
|
||||
float m_radius;
|
||||
DirectX::SimpleMath::Matrix m_proj;
|
||||
DirectX::SimpleMath::Matrix m_view;
|
||||
|
||||
// Assets & Scene
|
||||
std::unique_ptr<DirectX::EffectTextureFactory> m_textureFactory;
|
||||
std::vector<std::unique_ptr<DirectX::Model>> m_models;
|
||||
|
|
|
@ -169,7 +169,6 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\Kits\ATGTK\ControllerFont.h" />
|
||||
<ClInclude Include="..\..\..\Kits\ATGTK\PerformanceTimersXbox.h" />
|
||||
<ClInclude Include="Camera.h" />
|
||||
<ClInclude Include="SimpleESRAM12.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="StepTimer.h" />
|
||||
|
@ -179,7 +178,6 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\Kits\ATGTK\PerformanceTimersXbox.cpp" />
|
||||
<ClCompile Include="Camera.cpp" />
|
||||
<ClCompile Include="SimpleESRAM12.cpp" />
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="DeviceResources.cpp" />
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h">
|
||||
<Filter>ATG Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Camera.h" />
|
||||
<ClInclude Include="..\..\..\Kits\ATGTK\PerformanceTimersXbox.h">
|
||||
<Filter>ATG Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
|
@ -50,7 +49,6 @@
|
|||
<ClCompile Include="DeviceResources.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Camera.cpp" />
|
||||
<ClCompile Include="..\..\..\Kits\ATGTK\PerformanceTimersXbox.cpp">
|
||||
<Filter>ATG Tool Kit</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <stdexcept>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pix.h>
|
||||
#include <xgmemory.h>
|
||||
|
||||
|
|
|
@ -133,10 +133,9 @@ void Sample::Update(DX::StepTimer const& timer)
|
|||
}
|
||||
|
||||
// Limit to avoid looking directly up or down
|
||||
float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, m_pitch);
|
||||
m_pitch = std::min(+limit, m_pitch);
|
||||
|
||||
const float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, std::min(+limit, m_pitch));
|
||||
|
||||
if (m_yaw > XM_PI)
|
||||
{
|
||||
m_yaw -= XM_PI * 2.f;
|
||||
|
|
|
@ -143,9 +143,8 @@ void Sample::Update(DX::StepTimer const& timer)
|
|||
}
|
||||
|
||||
// Limit to avoid looking directly up or down
|
||||
float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, m_pitch);
|
||||
m_pitch = std::min(+limit, m_pitch);
|
||||
const float limit = XM_PI / 2.0f - 0.01f;
|
||||
m_pitch = std::max(-limit, std::min(+limit, m_pitch));
|
||||
|
||||
if (m_yaw > XM_PI)
|
||||
{
|
||||
|
|
|
@ -176,6 +176,7 @@
|
|||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
</ClCompile>
|
||||
<FXCompile>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
#include <stdio.h>
|
||||
#include <pix.h>
|
||||
|
||||
// Workaround for /permissive- issue specific to the Xbox One XDK winrt/base.h
|
||||
#define JSCRIPT_E_CANTEXECUTE _HRESULT_TYPEDEF_(0x89020001U)
|
||||
|
||||
#include "winrt/Windows.ApplicationModel.h"
|
||||
#include "winrt/Windows.ApplicationModel.Core.h"
|
||||
#include "winrt/Windows.ApplicationModel.Activation.h"
|
||||
|
|
|
@ -176,6 +176,7 @@
|
|||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
</ClCompile>
|
||||
<FXCompile>
|
||||
<ShaderModel>5.1</ShaderModel>
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
#include <stdio.h>
|
||||
#include <pix.h>
|
||||
|
||||
// Workaround for /permissive- issue specific to the Xbox One XDK winrt/base.h
|
||||
#define JSCRIPT_E_CANTEXECUTE _HRESULT_TYPEDEF_(0x89020001U)
|
||||
|
||||
#include "winrt/Windows.ApplicationModel.h"
|
||||
#include "winrt/Windows.ApplicationModel.Core.h"
|
||||
#include "winrt/Windows.ApplicationModel.Activation.h"
|
||||
|
|
|
@ -170,6 +170,7 @@
|
|||
<AdditionalOptions>/await /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
</ClCompile>
|
||||
<FXCompile>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
</ClCompile>
|
||||
<FXCompile>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
#include <stdio.h>
|
||||
#include <pix.h>
|
||||
|
||||
// Workaround for /permissive- issue specific to the Xbox One XDK winrt/base.h
|
||||
#define JSCRIPT_E_CANTEXECUTE _HRESULT_TYPEDEF_(0x89020001U)
|
||||
|
||||
#include "winrt/Windows.ApplicationModel.h"
|
||||
#include "winrt/Windows.ApplicationModel.Core.h"
|
||||
#include "winrt/Windows.ApplicationModel.Activation.h"
|
||||
|
|
|
@ -80,6 +80,7 @@ enum OPTIONS
|
|||
OPT_NOLOGO,
|
||||
OPT_TIMING,
|
||||
OPT_SEPALPHA,
|
||||
OPT_NO_WIC,
|
||||
OPT_TYPELESS_UNORM,
|
||||
OPT_TYPELESS_FLOAT,
|
||||
OPT_PREMUL_ALPHA,
|
||||
|
@ -166,6 +167,7 @@ const SValue g_pOptions[] =
|
|||
{ L"nologo", OPT_NOLOGO },
|
||||
{ L"timing", OPT_TIMING },
|
||||
{ L"sepalpha", OPT_SEPALPHA },
|
||||
{ L"nowic", OPT_NO_WIC },
|
||||
{ L"tu", OPT_TYPELESS_UNORM },
|
||||
{ L"tf", OPT_TYPELESS_FLOAT },
|
||||
{ L"pmalpha", OPT_PREMUL_ALPHA },
|
||||
|
@ -732,6 +734,7 @@ namespace
|
|||
wprintf(L" -vflip vertical flip of source image\n");
|
||||
wprintf(L" -sepalpha resize/generate mips alpha channel separately\n");
|
||||
wprintf(L" from color channels\n");
|
||||
wprintf(L" -nowic Force non-WIC filtering\n");
|
||||
wprintf(L" -wrap, -mirror texture addressing mode (wrap, mirror, or clamp)\n");
|
||||
wprintf(L" -pmalpha convert final texture to use premultiplied alpha\n");
|
||||
wprintf(L" -alpha convert premultiplied alpha to straight alpha\n");
|
||||
|
@ -770,7 +773,7 @@ namespace
|
|||
L" (defaults to 1.0)\n");
|
||||
wprintf(L" -c <hex-RGB> colorkey (a.k.a. chromakey) transparency\n");
|
||||
wprintf(L" -rotatecolor <rot> rotates color primaries and/or applies a curve\n");
|
||||
wprintf(L" -nits <value> paper-white value in nits to use for HDR10 (defaults to 200.0)\n");
|
||||
wprintf(L" -nits <value> paper-white value in nits to use for HDR10 (def: 200.0)\n");
|
||||
wprintf(L" -tonemap Apply a tonemap operator based on maximum luminance\n");
|
||||
wprintf(L" -x2bias Enable *2 - 1 conversion cases for unorm/pos-only-float\n");
|
||||
wprintf(L" -flist <filename> use text file with a list of input files (one per line)\n");
|
||||
|
@ -1304,6 +1307,10 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
dwFilterOpts |= TEX_FILTER_SEPARATE_ALPHA;
|
||||
break;
|
||||
|
||||
case OPT_NO_WIC:
|
||||
dwFilterOpts |= TEX_FILTER_FORCE_NON_WIC;
|
||||
break;
|
||||
|
||||
case OPT_PREFIX:
|
||||
wcscpy_s(szPrefix, MAX_PATH, pValue);
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче