Updated to Visual Studio 2015 (only required minor changes)
Updated DirectX TK version
This commit is contained in:
parent
117a4b073d
commit
8f3cd51743
40 changed files with 2237 additions and 665 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -161,3 +161,5 @@ $RECYCLE.BIN/
|
|||
*.trt
|
||||
*.zip
|
||||
*.rar
|
||||
|
||||
*.VC.opendb
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -27,26 +27,26 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -28,26 +28,26 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
BIN
Dependencies/DirectXTK.Debug.x64.lib
vendored
BIN
Dependencies/DirectXTK.Debug.x64.lib
vendored
Binary file not shown.
BIN
Dependencies/DirectXTK.Debug.x86.lib
vendored
BIN
Dependencies/DirectXTK.Debug.x86.lib
vendored
Binary file not shown.
BIN
Dependencies/DirectXTK.Release.x64.lib
vendored
BIN
Dependencies/DirectXTK.Release.x64.lib
vendored
Binary file not shown.
BIN
Dependencies/DirectXTK.Release.x86.lib
vendored
BIN
Dependencies/DirectXTK.Release.x86.lib
vendored
Binary file not shown.
|
@ -23,7 +23,9 @@ namespace Mesen.GUI
|
|||
using(Stream s = a.GetManifestResourceStream(resourceName)) {
|
||||
byte[] buffer = new byte[s.Length];
|
||||
s.Read(buffer, 0, (int)s.Length);
|
||||
try {
|
||||
File.WriteAllBytes(Path.Combine(ConfigManager.HomeFolder, filename), buffer);
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +46,9 @@ namespace Mesen.GUI
|
|||
File.Delete(outputFilename);
|
||||
} catch { }
|
||||
}
|
||||
try {
|
||||
entry.ExtractToFile(outputFilename);
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Mesen.GUI
|
|||
if(!File.Exists("WinMesen.dll")) {
|
||||
MessageBox.Show("Mesen was unable to start due to missing files." + Environment.NewLine + Environment.NewLine + "Error: WinMesen.dll is missing.", "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
} else {
|
||||
if(MessageBox.Show("Mesen was unable to start due to missing dependencies." + Environment.NewLine + Environment.NewLine + "Mesen requires the Visual Studio 2013 runtime. Would you like to download the runtime from Microsoft's website and install it?", "Mesen", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
|
||||
if(MessageBox.Show("Mesen was unable to start due to missing dependencies." + Environment.NewLine + Environment.NewLine + "Mesen requires the Visual Studio 2015 runtime. Would you like to download the runtime from Microsoft's website and install it?", "Mesen", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
|
||||
if(!RuntimeChecker.DownloadRuntime()) {
|
||||
MessageBox.Show("The Visual Studio Runtime could not be installed properly.", "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
} else {
|
||||
|
@ -38,13 +38,13 @@ namespace Mesen.GUI
|
|||
string link = string.Empty;
|
||||
if(IntPtr.Size == 4) {
|
||||
//x86
|
||||
link = "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe";
|
||||
link = "http://download.microsoft.com/download/C/E/5/CE514EAE-78A8-4381-86E8-29108D78DBD4/VC_redist.x86.exe";
|
||||
} else {
|
||||
//x64
|
||||
link = "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe";
|
||||
link = "http://download.microsoft.com/download/C/E/5/CE514EAE-78A8-4381-86E8-29108D78DBD4/VC_redist.x64.exe";
|
||||
}
|
||||
|
||||
string tempFilename = Path.GetTempPath() + "Mesen_VsRuntime2013.exe";
|
||||
string tempFilename = Path.GetTempPath() + "Mesen_VsRuntime2015.exe";
|
||||
|
||||
try {
|
||||
frmDownloadProgress frm = new frmDownloadProgress(link, tempFilename);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -35,40 +35,40 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
9
NES.sln
9
NES.sln
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30501.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core.vcxproj", "{78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
|
@ -47,6 +47,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NesNtsc", "NesNtsc\NesNtsc.
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DependencyPacker", "DependencyPacker\DependencyPacker.csproj", "{AABB5225-3A49-47FF-8A48-031673CADCE9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F237C270-07EA-4B15-BFC9-C124D09F9C59}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Performance1.psess = Performance1.psess
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -27,26 +27,26 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -35,40 +35,40 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -27,26 +27,26 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#pragma comment(lib,"ws2_32.lib") //Winsock Library
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <Ws2tcpip.h>
|
||||
#include <Windows.h>
|
||||
|
||||
Socket::Socket()
|
||||
|
@ -114,33 +115,37 @@ void Socket::Bind(uint16_t port)
|
|||
bool Socket::Connect(const char* hostname, uint16_t port)
|
||||
{
|
||||
// Resolve IP address for hostname
|
||||
struct hostent *host;
|
||||
if((host = gethostbyname(hostname)) == NULL) {
|
||||
bool result = false;
|
||||
addrinfo hint;
|
||||
memset((void*)&hint, 0, sizeof(hint));
|
||||
hint.ai_family = AF_INET;
|
||||
hint.ai_protocol = IPPROTO_TCP;
|
||||
hint.ai_socktype = SOCK_STREAM;
|
||||
addrinfo *addrInfo;
|
||||
|
||||
if(getaddrinfo(hostname, std::to_string(port).c_str(), &hint, &addrInfo) != 0) {
|
||||
std::cout << "Failed to resolve hostname." << std::endl;
|
||||
SetConnectionErrorFlag();
|
||||
} else {
|
||||
// Setup our socket address structure
|
||||
SOCKADDR_IN SockAddr;
|
||||
SockAddr.sin_port = htons(port);
|
||||
SockAddr.sin_family = AF_INET;
|
||||
SockAddr.sin_addr.s_addr = *((unsigned long*)host->h_addr);
|
||||
|
||||
u_long iMode = 0;
|
||||
ioctlsocket(_socket, FIONBIO, &iMode);
|
||||
|
||||
// Attempt to connect to server
|
||||
if(connect(_socket, (SOCKADDR*)(&SockAddr), sizeof(SockAddr)) == SOCKET_ERROR) {
|
||||
if(connect(_socket, addrInfo->ai_addr, (int)addrInfo->ai_addrlen) == SOCKET_ERROR) {
|
||||
std::cout << "Failed to establish connection with server." << std::endl;
|
||||
SetConnectionErrorFlag();
|
||||
} else {
|
||||
iMode = 1;
|
||||
ioctlsocket(_socket, FIONBIO, &iMode);
|
||||
|
||||
return true;
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
freeaddrinfo(addrInfo);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Socket::Listen(int backlog)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -35,40 +35,40 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
#pragma comment(lib,"PhoneAudioSes.lib")
|
||||
#endif
|
||||
|
||||
#ifndef XAUDIO2_HELPER_FUNCTIONS
|
||||
#define XAUDIO2_HELPER_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
#error DirectX Tool Kit for Audio does not support VS 2010 without the DirectX SDK
|
||||
|
@ -63,13 +67,33 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// VS 2010 doesn't support explicit calling convention for std::function
|
||||
#ifndef DIRECTX_STD_CALLCONV
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
#define DIRECTX_STD_CALLCONV
|
||||
#else
|
||||
#define DIRECTX_STD_CALLCONV __cdecl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4481)
|
||||
// VS 2010 considers 'override' to be a extension, but it's part of C++11 as of VS 2012
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
#if (DIRECTXMATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#define XM_CALLCONV __fastcall
|
||||
typedef const XMVECTOR& HXMVECTOR;
|
||||
typedef const XMMATRIX& FXMMATRIX;
|
||||
|
@ -98,26 +122,26 @@ namespace DirectX
|
|||
class IVoiceNotify
|
||||
{
|
||||
public:
|
||||
virtual void OnBufferEnd() = 0;
|
||||
virtual void __cdecl OnBufferEnd() = 0;
|
||||
// Notfication that a voice buffer has finished
|
||||
// Note this is called from XAudio2's worker thread, so it should perform very minimal and thread-safe operations
|
||||
|
||||
virtual void OnCriticalError() = 0;
|
||||
virtual void __cdecl OnCriticalError() = 0;
|
||||
// Notification that the audio engine encountered a critical error
|
||||
|
||||
virtual void OnReset() = 0;
|
||||
virtual void __cdecl OnReset() = 0;
|
||||
// Notification of an audio engine reset
|
||||
|
||||
virtual void OnUpdate() = 0;
|
||||
virtual void __cdecl OnUpdate() = 0;
|
||||
// Notification of an audio engine per-frame update (opt-in)
|
||||
|
||||
virtual void OnDestroyEngine() = 0;
|
||||
virtual void __cdecl OnDestroyEngine() = 0;
|
||||
// Notification that the audio engine is being destroyed
|
||||
|
||||
virtual void OnTrim() = 0;
|
||||
virtual void __cdecl OnTrim() = 0;
|
||||
// Notification of a request to trim the voice pool
|
||||
|
||||
virtual void GatherStatistics( AudioStatistics& stats ) const = 0;
|
||||
virtual void __cdecl GatherStatistics( AudioStatistics& stats ) const = 0;
|
||||
// Contribute to statistics request
|
||||
};
|
||||
|
||||
|
@ -205,75 +229,81 @@ namespace DirectX
|
|||
AudioEngine& operator= (AudioEngine&& moveFrom);
|
||||
virtual ~AudioEngine();
|
||||
|
||||
bool Update();
|
||||
bool __cdecl Update();
|
||||
// Performs per-frame processing for the audio engine, returns false if in 'silent mode'
|
||||
|
||||
bool Reset( _In_opt_ const WAVEFORMATEX* wfx = nullptr, _In_opt_z_ const wchar_t* deviceId = nullptr );
|
||||
bool __cdecl Reset( _In_opt_ const WAVEFORMATEX* wfx = nullptr, _In_opt_z_ const wchar_t* deviceId = nullptr );
|
||||
// Reset audio engine from critical error/silent mode using a new device; can also 'migrate' the graph
|
||||
// Returns true if succesfully reset, false if in 'silent mode' due to no default device
|
||||
// Note: One shots are lost, all SoundEffectInstances are in the STOPPED state after successful reset
|
||||
|
||||
void Suspend();
|
||||
void Resume();
|
||||
void __cdecl Suspend();
|
||||
void __cdecl Resume();
|
||||
// Suspend/resumes audio processing (i.e. global pause/resume)
|
||||
|
||||
void SetReverb( AUDIO_ENGINE_REVERB reverb );
|
||||
void SetReverb( _In_opt_ const XAUDIO2FX_REVERB_PARAMETERS* native );
|
||||
float __cdecl GetMasterVolume() const;
|
||||
void __cdecl SetMasterVolume( float volume );
|
||||
// Master volume property for all sounds
|
||||
|
||||
void __cdecl SetReverb( AUDIO_ENGINE_REVERB reverb );
|
||||
void __cdecl SetReverb( _In_opt_ const XAUDIO2FX_REVERB_PARAMETERS* native );
|
||||
// Sets environmental reverb for 3D positional audio (if active)
|
||||
|
||||
void SetMasteringLimit( int release, int loudness );
|
||||
void __cdecl SetMasteringLimit( int release, int loudness );
|
||||
// Sets the mastering volume limiter properties (if active)
|
||||
|
||||
AudioStatistics GetStatistics() const;
|
||||
AudioStatistics __cdecl GetStatistics() const;
|
||||
// Gathers audio engine statistics
|
||||
|
||||
WAVEFORMATEXTENSIBLE GetOutputFormat() const;
|
||||
WAVEFORMATEXTENSIBLE __cdecl GetOutputFormat() const;
|
||||
// Returns the format consumed by the mastering voice (which is the same as the device output if defaults are used)
|
||||
|
||||
uint32_t GetChannelMask() const;
|
||||
uint32_t __cdecl GetChannelMask() const;
|
||||
// Returns the output channel mask
|
||||
|
||||
int GetOutputChannels() const;
|
||||
int __cdecl GetOutputChannels() const;
|
||||
// Returns the number of output channels
|
||||
|
||||
bool IsAudioDevicePresent() const;
|
||||
bool __cdecl IsAudioDevicePresent() const;
|
||||
// Returns true if the audio graph is operating normally, false if in 'silent mode'
|
||||
|
||||
bool IsCriticalError() const;
|
||||
bool __cdecl IsCriticalError() const;
|
||||
// Returns true if the audio graph is halted due to a critical error (which also places the engine into 'silent mode')
|
||||
|
||||
// Voice pool management.
|
||||
void SetDefaultSampleRate( int sampleRate );
|
||||
void __cdecl SetDefaultSampleRate( int sampleRate );
|
||||
// Sample rate for voices in the reuse pool (defaults to 44100)
|
||||
|
||||
void SetMaxVoicePool( size_t maxOneShots, size_t maxInstances );
|
||||
void __cdecl SetMaxVoicePool( size_t maxOneShots, size_t maxInstances );
|
||||
// Maximum number of voices to allocate for one-shots and instances
|
||||
// Note: one-shots over this limit are ignored; too many instance voices throws an exception
|
||||
|
||||
void TrimVoicePool();
|
||||
void __cdecl TrimVoicePool();
|
||||
// Releases any currently unused voices
|
||||
|
||||
void AllocateVoice( _In_ const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags, bool oneshot, _Outptr_result_maybenull_ IXAudio2SourceVoice** voice );
|
||||
// Internal-use functions
|
||||
void __cdecl AllocateVoice( _In_ const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags, bool oneshot, _Outptr_result_maybenull_ IXAudio2SourceVoice** voice );
|
||||
|
||||
void DestroyVoice( _In_ IXAudio2SourceVoice* voice );
|
||||
void __cdecl DestroyVoice( _In_ IXAudio2SourceVoice* voice );
|
||||
// Should only be called for instance voices, not one-shots
|
||||
|
||||
void RegisterNotify( _In_ IVoiceNotify* notify, bool usesUpdate );
|
||||
void UnregisterNotify( _In_ IVoiceNotify* notify, bool usesOneShots, bool usesUpdate );
|
||||
void __cdecl RegisterNotify( _In_ IVoiceNotify* notify, bool usesUpdate );
|
||||
void __cdecl UnregisterNotify( _In_ IVoiceNotify* notify, bool usesOneShots, bool usesUpdate );
|
||||
|
||||
// XAudio2 interface access
|
||||
IXAudio2* GetInterface() const;
|
||||
IXAudio2MasteringVoice* GetMasterVoice() const;
|
||||
IXAudio2SubmixVoice* GetReverbVoice() const;
|
||||
X3DAUDIO_HANDLE& Get3DHandle() const;
|
||||
IXAudio2* __cdecl GetInterface() const;
|
||||
IXAudio2MasteringVoice* __cdecl GetMasterVoice() const;
|
||||
IXAudio2SubmixVoice* __cdecl GetReverbVoice() const;
|
||||
X3DAUDIO_HANDLE& __cdecl Get3DHandle() const;
|
||||
|
||||
// Static functions
|
||||
struct RendererDetail
|
||||
{
|
||||
std::wstring deviceId;
|
||||
std::wstring description;
|
||||
};
|
||||
|
||||
static std::vector<RendererDetail> GetRendererDetails();
|
||||
static std::vector<RendererDetail> __cdecl GetRendererDetails();
|
||||
// Returns a list of valid audio endpoint devices
|
||||
|
||||
private:
|
||||
|
@ -282,8 +312,8 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
AudioEngine(AudioEngine const&);
|
||||
AudioEngine& operator= (AudioEngine const&);
|
||||
AudioEngine(AudioEngine const&) DIRECTX_CTOR_DELETE
|
||||
AudioEngine& operator= (AudioEngine const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -297,33 +327,36 @@ namespace DirectX
|
|||
WaveBank& operator= (WaveBank&& moveFrom);
|
||||
virtual ~WaveBank();
|
||||
|
||||
void Play( int index );
|
||||
void Play( _In_z_ const char* name );
|
||||
void __cdecl Play( int index );
|
||||
void __cdecl Play( int index, float volume, float pitch, float pan );
|
||||
|
||||
std::unique_ptr<SoundEffectInstance> CreateInstance( int index, SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||
std::unique_ptr<SoundEffectInstance> CreateInstance( _In_z_ const char* name, SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||
void __cdecl Play( _In_z_ const char* name );
|
||||
void __cdecl Play( _In_z_ const char* name, float volume, float pitch, float pan );
|
||||
|
||||
bool IsPrepared() const;
|
||||
bool IsInUse() const;
|
||||
bool IsStreamingBank() const;
|
||||
std::unique_ptr<SoundEffectInstance> __cdecl CreateInstance( int index, SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||
std::unique_ptr<SoundEffectInstance> __cdecl CreateInstance( _In_z_ const char* name, SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||
|
||||
size_t GetSampleSizeInBytes( int index ) const;
|
||||
bool __cdecl IsPrepared() const;
|
||||
bool __cdecl IsInUse() const;
|
||||
bool __cdecl IsStreamingBank() const;
|
||||
|
||||
size_t __cdecl GetSampleSizeInBytes( int index ) const;
|
||||
// Returns size of wave audio data
|
||||
|
||||
size_t GetSampleDuration( int index ) const;
|
||||
size_t __cdecl GetSampleDuration( int index ) const;
|
||||
// Returns the duration in samples
|
||||
|
||||
size_t GetSampleDurationMS( int index ) const;
|
||||
size_t __cdecl GetSampleDurationMS( int index ) const;
|
||||
// Returns the duration in milliseconds
|
||||
|
||||
const WAVEFORMATEX* GetFormat( int index, _Out_writes_bytes_(maxsize) WAVEFORMATEX* wfx, size_t maxsize ) const;
|
||||
const WAVEFORMATEX* __cdecl GetFormat( int index, _Out_writes_bytes_(maxsize) WAVEFORMATEX* wfx, size_t maxsize ) const;
|
||||
|
||||
int Find( _In_z_ const char* name ) const;
|
||||
int __cdecl Find( _In_z_ const char* name ) const;
|
||||
|
||||
#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
|
||||
bool FillSubmitBuffer( int index, _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer ) const;
|
||||
#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ )
|
||||
bool __cdecl FillSubmitBuffer( int index, _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer ) const;
|
||||
#else
|
||||
void FillSubmitBuffer( int index, _Out_ XAUDIO2_BUFFER& buffer ) const;
|
||||
void __cdecl FillSubmitBuffer( int index, _Out_ XAUDIO2_BUFFER& buffer ) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -333,11 +366,11 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
WaveBank(WaveBank const&);
|
||||
WaveBank& operator= (WaveBank const&);
|
||||
WaveBank(WaveBank const&) DIRECTX_CTOR_DELETE
|
||||
WaveBank& operator= (WaveBank const&) DIRECTX_CTOR_DELETE
|
||||
|
||||
// Private interface
|
||||
void UnregisterInstance( _In_ SoundEffectInstance* instance );
|
||||
void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance );
|
||||
|
||||
friend class SoundEffectInstance;
|
||||
};
|
||||
|
@ -356,7 +389,7 @@ namespace DirectX
|
|||
_In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes,
|
||||
uint32_t loopStart, uint32_t loopLength );
|
||||
|
||||
#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
|
||||
#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/)
|
||||
|
||||
SoundEffect( _In_ AudioEngine* engine, _Inout_ std::unique_ptr<uint8_t[]>& wavData,
|
||||
_In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes,
|
||||
|
@ -368,27 +401,28 @@ namespace DirectX
|
|||
SoundEffect& operator= (SoundEffect&& moveFrom);
|
||||
virtual ~SoundEffect();
|
||||
|
||||
void Play();
|
||||
void __cdecl Play();
|
||||
void __cdecl Play(float volume, float pitch, float pan);
|
||||
|
||||
std::unique_ptr<SoundEffectInstance> CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||
std::unique_ptr<SoundEffectInstance> __cdecl CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||
|
||||
bool IsInUse() const;
|
||||
bool __cdecl IsInUse() const;
|
||||
|
||||
size_t GetSampleSizeInBytes() const;
|
||||
size_t __cdecl GetSampleSizeInBytes() const;
|
||||
// Returns size of wave audio data
|
||||
|
||||
size_t GetSampleDuration() const;
|
||||
size_t __cdecl GetSampleDuration() const;
|
||||
// Returns the duration in samples
|
||||
|
||||
size_t GetSampleDurationMS() const;
|
||||
size_t __cdecl GetSampleDurationMS() const;
|
||||
// Returns the duration in milliseconds
|
||||
|
||||
const WAVEFORMATEX* GetFormat() const;
|
||||
const WAVEFORMATEX* __cdecl GetFormat() const;
|
||||
|
||||
#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
|
||||
bool FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer ) const;
|
||||
#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/)
|
||||
bool __cdecl FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer ) const;
|
||||
#else
|
||||
void FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer ) const;
|
||||
void __cdecl FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer ) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -398,11 +432,11 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
SoundEffect(SoundEffect const&);
|
||||
SoundEffect& operator= (SoundEffect const&);
|
||||
SoundEffect(SoundEffect const&) DIRECTX_CTOR_DELETE
|
||||
SoundEffect& operator= (SoundEffect const&) DIRECTX_CTOR_DELETE
|
||||
|
||||
// Private interface
|
||||
void UnregisterInstance( _In_ SoundEffectInstance* instance );
|
||||
void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance );
|
||||
|
||||
friend class SoundEffectInstance;
|
||||
};
|
||||
|
@ -415,7 +449,8 @@ namespace DirectX
|
|||
{
|
||||
memset( this, 0, sizeof(X3DAUDIO_LISTENER) );
|
||||
|
||||
OrientFront.z =
|
||||
OrientFront.z = -1.f;
|
||||
|
||||
OrientTop.y = 1.f;
|
||||
}
|
||||
|
||||
|
@ -423,7 +458,7 @@ namespace DirectX
|
|||
{
|
||||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &Position ), v );
|
||||
}
|
||||
void SetPosition( const XMFLOAT3& pos )
|
||||
void __cdecl SetPosition( const XMFLOAT3& pos )
|
||||
{
|
||||
Position.x = pos.x;
|
||||
Position.y = pos.y;
|
||||
|
@ -434,7 +469,7 @@ namespace DirectX
|
|||
{
|
||||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &Velocity ), v );
|
||||
}
|
||||
void SetVelocity( const XMFLOAT3& vel )
|
||||
void __cdecl SetVelocity( const XMFLOAT3& vel )
|
||||
{
|
||||
Velocity.x = vel.x;
|
||||
Velocity.y = vel.y;
|
||||
|
@ -446,7 +481,7 @@ namespace DirectX
|
|||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &OrientFront ), forward );
|
||||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &OrientTop ), up );
|
||||
}
|
||||
void SetOrientation( const XMFLOAT3& forward, const XMFLOAT3& up )
|
||||
void __cdecl SetOrientation( const XMFLOAT3& forward, const XMFLOAT3& up )
|
||||
{
|
||||
OrientFront.x = forward.x; OrientTop.x = up.x;
|
||||
OrientFront.y = forward.y; OrientTop.y = up.y;
|
||||
|
@ -499,7 +534,8 @@ namespace DirectX
|
|||
memset( this, 0, sizeof(X3DAUDIO_EMITTER) );
|
||||
memset( EmitterAzimuths, 0, sizeof(EmitterAzimuths) );
|
||||
|
||||
OrientFront.z =
|
||||
OrientFront.z = -1.f;
|
||||
|
||||
OrientTop.y =
|
||||
ChannelRadius =
|
||||
CurveDistanceScaler =
|
||||
|
@ -515,7 +551,7 @@ namespace DirectX
|
|||
{
|
||||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &Position ), v );
|
||||
}
|
||||
void SetPosition( const XMFLOAT3& pos )
|
||||
void __cdecl SetPosition( const XMFLOAT3& pos )
|
||||
{
|
||||
Position.x = pos.x;
|
||||
Position.y = pos.y;
|
||||
|
@ -526,7 +562,7 @@ namespace DirectX
|
|||
{
|
||||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &Velocity ), v );
|
||||
}
|
||||
void SetVelocity( const XMFLOAT3& vel )
|
||||
void __cdecl SetVelocity( const XMFLOAT3& vel )
|
||||
{
|
||||
Velocity.x = vel.x;
|
||||
Velocity.y = vel.y;
|
||||
|
@ -538,7 +574,7 @@ namespace DirectX
|
|||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &OrientFront ), forward );
|
||||
XMStoreFloat3( reinterpret_cast<XMFLOAT3*>( &OrientTop ), up );
|
||||
}
|
||||
void SetOrientation( const XMFLOAT3& forward, const XMFLOAT3& up )
|
||||
void __cdecl SetOrientation( const XMFLOAT3& forward, const XMFLOAT3& up )
|
||||
{
|
||||
OrientFront.x = forward.x; OrientTop.x = up.x;
|
||||
OrientFront.y = forward.y; OrientTop.y = up.y;
|
||||
|
@ -589,23 +625,23 @@ namespace DirectX
|
|||
SoundEffectInstance& operator= (SoundEffectInstance&& moveFrom);
|
||||
virtual ~SoundEffectInstance();
|
||||
|
||||
void Play( bool loop = false );
|
||||
void Stop( bool immediate = true );
|
||||
void Pause();
|
||||
void Resume();
|
||||
void __cdecl Play( bool loop = false );
|
||||
void __cdecl Stop( bool immediate = true );
|
||||
void __cdecl Pause();
|
||||
void __cdecl Resume();
|
||||
|
||||
void SetVolume( float volume );
|
||||
void SetPitch( float pitch );
|
||||
void SetPan( float pan );
|
||||
void __cdecl SetVolume( float volume );
|
||||
void __cdecl SetPitch( float pitch );
|
||||
void __cdecl SetPan( float pan );
|
||||
|
||||
void Apply3D( const AudioListener& listener, const AudioEmitter& emitter );
|
||||
void __cdecl Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords = true );
|
||||
|
||||
bool IsLooped() const;
|
||||
bool __cdecl IsLooped() const;
|
||||
|
||||
SoundState GetState();
|
||||
SoundState __cdecl GetState();
|
||||
|
||||
// Notifications.
|
||||
void OnDestroyParent();
|
||||
void __cdecl OnDestroyParent();
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -617,12 +653,12 @@ namespace DirectX
|
|||
SoundEffectInstance( _In_ AudioEngine* engine, _In_ SoundEffect* effect, SOUND_EFFECT_INSTANCE_FLAGS flags );
|
||||
SoundEffectInstance( _In_ AudioEngine* engine, _In_ WaveBank* effect, int index, SOUND_EFFECT_INSTANCE_FLAGS flags );
|
||||
|
||||
friend std::unique_ptr<SoundEffectInstance> SoundEffect::CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS );
|
||||
friend std::unique_ptr<SoundEffectInstance> WaveBank::CreateInstance( int, SOUND_EFFECT_INSTANCE_FLAGS );
|
||||
friend std::unique_ptr<SoundEffectInstance> __cdecl SoundEffect::CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS );
|
||||
friend std::unique_ptr<SoundEffectInstance> __cdecl WaveBank::CreateInstance( int, SOUND_EFFECT_INSTANCE_FLAGS );
|
||||
|
||||
// Prevent copying.
|
||||
SoundEffectInstance(SoundEffectInstance const&);
|
||||
SoundEffectInstance& operator= (SoundEffectInstance const&);
|
||||
SoundEffectInstance(SoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
||||
SoundEffectInstance& operator= (SoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -631,41 +667,41 @@ namespace DirectX
|
|||
{
|
||||
public:
|
||||
DynamicSoundEffectInstance( _In_ AudioEngine* engine,
|
||||
_In_opt_ std::function<void(DynamicSoundEffectInstance*)> bufferNeeded,
|
||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV(DynamicSoundEffectInstance*)> bufferNeeded,
|
||||
int sampleRate, int channels, int sampleBits = 16,
|
||||
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||
DynamicSoundEffectInstance(DynamicSoundEffectInstance&& moveFrom);
|
||||
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance&& moveFrom);
|
||||
virtual ~DynamicSoundEffectInstance();
|
||||
|
||||
void Play();
|
||||
void Stop( bool immediate = true );
|
||||
void Pause();
|
||||
void Resume();
|
||||
void __cdecl Play();
|
||||
void __cdecl Stop( bool immediate = true );
|
||||
void __cdecl Pause();
|
||||
void __cdecl Resume();
|
||||
|
||||
void SetVolume( float volume );
|
||||
void SetPitch( float pitch );
|
||||
void SetPan( float pan );
|
||||
void __cdecl SetVolume( float volume );
|
||||
void __cdecl SetPitch( float pitch );
|
||||
void __cdecl SetPan( float pan );
|
||||
|
||||
void Apply3D( const AudioListener& listener, const AudioEmitter& emitter );
|
||||
void __cdecl Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords = true );
|
||||
|
||||
void SubmitBuffer( _In_reads_bytes_(audioBytes) const uint8_t* pAudioData, size_t audioBytes );
|
||||
void SubmitBuffer( _In_reads_bytes_(audioBytes) const uint8_t* pAudioData, uint32_t offset, size_t audioBytes );
|
||||
void __cdecl SubmitBuffer( _In_reads_bytes_(audioBytes) const uint8_t* pAudioData, size_t audioBytes );
|
||||
void __cdecl SubmitBuffer( _In_reads_bytes_(audioBytes) const uint8_t* pAudioData, uint32_t offset, size_t audioBytes );
|
||||
|
||||
SoundState GetState();
|
||||
SoundState __cdecl GetState();
|
||||
|
||||
size_t GetSampleDuration( size_t bytes ) const;
|
||||
size_t __cdecl GetSampleDuration( size_t bytes ) const;
|
||||
// Returns duration in samples of a buffer of a given size
|
||||
|
||||
size_t GetSampleDurationMS( size_t bytes ) const;
|
||||
size_t __cdecl GetSampleDurationMS( size_t bytes ) const;
|
||||
// Returns duration in milliseconds of a buffer of a given size
|
||||
|
||||
size_t GetSampleSizeInBytes( uint64_t duration ) const;
|
||||
size_t __cdecl GetSampleSizeInBytes( uint64_t duration ) const;
|
||||
// Returns size of a buffer for a duration given in milliseconds
|
||||
|
||||
int GetPendingBufferCount() const;
|
||||
int __cdecl GetPendingBufferCount() const;
|
||||
|
||||
const WAVEFORMATEX* GetFormat() const;
|
||||
const WAVEFORMATEX* __cdecl GetFormat() const;
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -674,8 +710,8 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
DynamicSoundEffectInstance(DynamicSoundEffectInstance const&);
|
||||
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance const&);
|
||||
DynamicSoundEffectInstance(DynamicSoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
||||
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -13,12 +13,23 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
@ -33,29 +44,29 @@ namespace DirectX
|
|||
virtual ~CommonStates();
|
||||
|
||||
// Blend states.
|
||||
ID3D11BlendState* Opaque() const;
|
||||
ID3D11BlendState* AlphaBlend() const;
|
||||
ID3D11BlendState* Additive() const;
|
||||
ID3D11BlendState* NonPremultiplied() const;
|
||||
ID3D11BlendState* __cdecl Opaque() const;
|
||||
ID3D11BlendState* __cdecl AlphaBlend() const;
|
||||
ID3D11BlendState* __cdecl Additive() const;
|
||||
ID3D11BlendState* __cdecl NonPremultiplied() const;
|
||||
|
||||
// Depth stencil states.
|
||||
ID3D11DepthStencilState* DepthNone() const;
|
||||
ID3D11DepthStencilState* DepthDefault() const;
|
||||
ID3D11DepthStencilState* DepthRead() const;
|
||||
ID3D11DepthStencilState* __cdecl DepthNone() const;
|
||||
ID3D11DepthStencilState* __cdecl DepthDefault() const;
|
||||
ID3D11DepthStencilState* __cdecl DepthRead() const;
|
||||
|
||||
// Rasterizer states.
|
||||
ID3D11RasterizerState* CullNone() const;
|
||||
ID3D11RasterizerState* CullClockwise() const;
|
||||
ID3D11RasterizerState* CullCounterClockwise() const;
|
||||
ID3D11RasterizerState* Wireframe() const;
|
||||
ID3D11RasterizerState* __cdecl CullNone() const;
|
||||
ID3D11RasterizerState* __cdecl CullClockwise() const;
|
||||
ID3D11RasterizerState* __cdecl CullCounterClockwise() const;
|
||||
ID3D11RasterizerState* __cdecl Wireframe() const;
|
||||
|
||||
// Sampler states.
|
||||
ID3D11SamplerState* PointWrap() const;
|
||||
ID3D11SamplerState* PointClamp() const;
|
||||
ID3D11SamplerState* LinearWrap() const;
|
||||
ID3D11SamplerState* LinearClamp() const;
|
||||
ID3D11SamplerState* AnisotropicWrap() const;
|
||||
ID3D11SamplerState* AnisotropicClamp() const;
|
||||
ID3D11SamplerState* __cdecl PointWrap() const;
|
||||
ID3D11SamplerState* __cdecl PointClamp() const;
|
||||
ID3D11SamplerState* __cdecl LinearWrap() const;
|
||||
ID3D11SamplerState* __cdecl LinearClamp() const;
|
||||
ID3D11SamplerState* __cdecl AnisotropicWrap() const;
|
||||
ID3D11SamplerState* __cdecl AnisotropicClamp() const;
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -64,7 +75,7 @@ namespace DirectX
|
|||
std::shared_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
CommonStates(CommonStates const&);
|
||||
CommonStates& operator= (CommonStates const&);
|
||||
CommonStates(CommonStates const&) DIRECTX_CTOR_DELETE
|
||||
CommonStates& operator= (CommonStates const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,11 +18,9 @@
|
|||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
|
@ -45,7 +43,7 @@ namespace DirectX
|
|||
};
|
||||
|
||||
// Standard version
|
||||
HRESULT CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
|
||||
_In_ size_t ddsDataSize,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
|
@ -54,7 +52,7 @@ namespace DirectX
|
|||
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
|
||||
);
|
||||
|
||||
HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
|
||||
|
@ -63,8 +61,13 @@ namespace DirectX
|
|||
);
|
||||
|
||||
// Standard version with optional auto-gen mipmap support
|
||||
HRESULT CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateDDSTextureFromMemory( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
|
||||
_In_ size_t ddsDataSize,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
|
@ -73,8 +76,13 @@ namespace DirectX
|
|||
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
|
||||
);
|
||||
|
||||
HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateDDSTextureFromFile( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
|
||||
|
@ -83,7 +91,7 @@ namespace DirectX
|
|||
);
|
||||
|
||||
// Extended version
|
||||
HRESULT CreateDDSTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateDDSTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
|
||||
_In_ size_t ddsDataSize,
|
||||
_In_ size_t maxsize,
|
||||
|
@ -97,7 +105,7 @@ namespace DirectX
|
|||
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
|
||||
);
|
||||
|
||||
HRESULT CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_In_ size_t maxsize,
|
||||
_In_ D3D11_USAGE usage,
|
||||
|
@ -111,8 +119,13 @@ namespace DirectX
|
|||
);
|
||||
|
||||
// Extended version with optional auto-gen mipmap support
|
||||
HRESULT CreateDDSTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateDDSTextureFromMemoryEx( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateDDSTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
|
||||
_In_ size_t ddsDataSize,
|
||||
_In_ size_t maxsize,
|
||||
|
@ -126,8 +139,13 @@ namespace DirectX
|
|||
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
|
||||
);
|
||||
|
||||
HRESULT CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateDDSTextureFromFileEx( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_In_ size_t maxsize,
|
||||
_In_ D3D11_USAGE usage,
|
||||
|
|
|
@ -13,16 +13,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#define NO_D3D11_DEBUG_NAME
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
|
||||
#if !defined(_XBOX_ONE) || !defined(_TITLE)
|
||||
#pragma comment(lib,"dxguid.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
|
||||
|
@ -111,7 +112,36 @@ namespace DirectX
|
|||
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const char (&name)[TNameLength])
|
||||
{
|
||||
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
WCHAR wname[MAX_PATH];
|
||||
int result = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, name, TNameLength, wname, MAX_PATH );
|
||||
if ( result > 0 )
|
||||
{
|
||||
resource->SetName( wname );
|
||||
}
|
||||
#else
|
||||
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name);
|
||||
#endif
|
||||
#else
|
||||
UNREFERENCED_PARAMETER(resource);
|
||||
UNREFERENCED_PARAMETER(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<UINT TNameLength>
|
||||
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const wchar_t (&name)[TNameLength])
|
||||
{
|
||||
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
resource->SetName( name );
|
||||
#else
|
||||
char aname[MAX_PATH];
|
||||
int result = WideCharToMultiByte( CP_ACP, 0, name, TNameLength, aname, MAX_PATH, nullptr, nullptr );
|
||||
if ( result > 0 )
|
||||
{
|
||||
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, aname);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
UNREFERENCED_PARAMETER(resource);
|
||||
UNREFERENCED_PARAMETER(name);
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -13,12 +13,23 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <memory>
|
||||
|
||||
|
@ -28,7 +39,7 @@
|
|||
|
||||
namespace DirectX
|
||||
{
|
||||
#if (DIRECTXMATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#define XM_CALLCONV __fastcall
|
||||
typedef const XMVECTOR& HXMVECTOR;
|
||||
typedef const XMMATRIX& FXMMATRIX;
|
||||
|
@ -41,9 +52,9 @@ namespace DirectX
|
|||
public:
|
||||
virtual ~IEffect() { }
|
||||
|
||||
virtual void Apply(_In_ ID3D11DeviceContext* deviceContext) = 0;
|
||||
virtual void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) = 0;
|
||||
|
||||
virtual void GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) = 0;
|
||||
virtual void __cdecl GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -65,16 +76,16 @@ namespace DirectX
|
|||
public:
|
||||
virtual ~IEffectLights() { }
|
||||
|
||||
virtual void SetLightingEnabled(bool value) = 0;
|
||||
virtual void SetPerPixelLighting(bool value) = 0;
|
||||
virtual void __cdecl SetLightingEnabled(bool value) = 0;
|
||||
virtual void __cdecl SetPerPixelLighting(bool value) = 0;
|
||||
virtual void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) = 0;
|
||||
|
||||
virtual void SetLightEnabled(int whichLight, bool value) = 0;
|
||||
virtual void __cdecl SetLightEnabled(int whichLight, bool value) = 0;
|
||||
virtual void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) = 0;
|
||||
virtual void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) = 0;
|
||||
virtual void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) = 0;
|
||||
|
||||
virtual void EnableDefaultLighting() = 0;
|
||||
virtual void __cdecl EnableDefaultLighting() = 0;
|
||||
|
||||
static const int MaxDirectionalLights = 3;
|
||||
};
|
||||
|
@ -86,9 +97,9 @@ namespace DirectX
|
|||
public:
|
||||
virtual ~IEffectFog() { }
|
||||
|
||||
virtual void SetFogEnabled(bool value) = 0;
|
||||
virtual void SetFogStart(float value) = 0;
|
||||
virtual void SetFogEnd(float value) = 0;
|
||||
virtual void __cdecl SetFogEnabled(bool value) = 0;
|
||||
virtual void __cdecl SetFogStart(float value) = 0;
|
||||
virtual void __cdecl SetFogEnd(float value) = 0;
|
||||
virtual void XM_CALLCONV SetFogColor(FXMVECTOR value) = 0;
|
||||
};
|
||||
|
||||
|
@ -99,9 +110,9 @@ namespace DirectX
|
|||
public:
|
||||
virtual ~IEffectSkinning() { }
|
||||
|
||||
virtual void SetWeightsPerVertex(int value) = 0;
|
||||
virtual void SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) = 0;
|
||||
virtual void ResetBoneTransforms() = 0;
|
||||
virtual void __cdecl SetWeightsPerVertex(int value) = 0;
|
||||
virtual void __cdecl SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) = 0;
|
||||
virtual void __cdecl ResetBoneTransforms() = 0;
|
||||
|
||||
static const int MaxBones = 72;
|
||||
};
|
||||
|
@ -118,9 +129,9 @@ namespace DirectX
|
|||
virtual ~BasicEffect();
|
||||
|
||||
// IEffect methods.
|
||||
void Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
|
||||
void GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
void __cdecl GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
|
||||
// Camera settings.
|
||||
void XM_CALLCONV SetWorld(FXMMATRIX value) override;
|
||||
|
@ -131,34 +142,34 @@ namespace DirectX
|
|||
void XM_CALLCONV SetDiffuseColor(FXMVECTOR value);
|
||||
void XM_CALLCONV SetEmissiveColor(FXMVECTOR value);
|
||||
void XM_CALLCONV SetSpecularColor(FXMVECTOR value);
|
||||
void SetSpecularPower(float value);
|
||||
void DisableSpecular();
|
||||
void SetAlpha(float value);
|
||||
void __cdecl SetSpecularPower(float value);
|
||||
void __cdecl DisableSpecular();
|
||||
void __cdecl SetAlpha(float value);
|
||||
|
||||
// Light settings.
|
||||
void SetLightingEnabled(bool value) override;
|
||||
void SetPerPixelLighting(bool value) override;
|
||||
void __cdecl SetLightingEnabled(bool value) override;
|
||||
void __cdecl SetPerPixelLighting(bool value) override;
|
||||
void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override;
|
||||
|
||||
void SetLightEnabled(int whichLight, bool value) override;
|
||||
void __cdecl SetLightEnabled(int whichLight, bool value) override;
|
||||
void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) override;
|
||||
void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) override;
|
||||
void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override;
|
||||
|
||||
void EnableDefaultLighting() override;
|
||||
void __cdecl EnableDefaultLighting() override;
|
||||
|
||||
// Fog settings.
|
||||
void SetFogEnabled(bool value) override;
|
||||
void SetFogStart(float value) override;
|
||||
void SetFogEnd(float value) override;
|
||||
void __cdecl SetFogEnabled(bool value) override;
|
||||
void __cdecl SetFogStart(float value) override;
|
||||
void __cdecl SetFogEnd(float value) override;
|
||||
void XM_CALLCONV SetFogColor(FXMVECTOR value) override;
|
||||
|
||||
// Vertex color setting.
|
||||
void SetVertexColorEnabled(bool value);
|
||||
void __cdecl SetVertexColorEnabled(bool value);
|
||||
|
||||
// Texture setting.
|
||||
void SetTextureEnabled(bool value);
|
||||
void SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTextureEnabled(bool value);
|
||||
void __cdecl SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -167,8 +178,8 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
BasicEffect(BasicEffect const&);
|
||||
BasicEffect& operator= (BasicEffect const&);
|
||||
BasicEffect(BasicEffect const&) DIRECTX_CTOR_DELETE
|
||||
BasicEffect& operator= (BasicEffect const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -183,9 +194,9 @@ namespace DirectX
|
|||
virtual ~AlphaTestEffect();
|
||||
|
||||
// IEffect methods.
|
||||
void Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
|
||||
void GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
void __cdecl GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
|
||||
// Camera settings.
|
||||
void XM_CALLCONV SetWorld(FXMMATRIX value) override;
|
||||
|
@ -194,23 +205,23 @@ namespace DirectX
|
|||
|
||||
// Material settings.
|
||||
void XM_CALLCONV SetDiffuseColor(FXMVECTOR value);
|
||||
void SetAlpha(float value);
|
||||
void __cdecl SetAlpha(float value);
|
||||
|
||||
// Fog settings.
|
||||
void SetFogEnabled(bool value) override;
|
||||
void SetFogStart(float value) override;
|
||||
void SetFogEnd(float value) override;
|
||||
void __cdecl SetFogEnabled(bool value) override;
|
||||
void __cdecl SetFogStart(float value) override;
|
||||
void __cdecl SetFogEnd(float value) override;
|
||||
void XM_CALLCONV SetFogColor(FXMVECTOR value) override;
|
||||
|
||||
// Vertex color setting.
|
||||
void SetVertexColorEnabled(bool value);
|
||||
void __cdecl SetVertexColorEnabled(bool value);
|
||||
|
||||
// Texture setting.
|
||||
void SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
|
||||
// Alpha test settings.
|
||||
void SetAlphaFunction(D3D11_COMPARISON_FUNC value);
|
||||
void SetReferenceAlpha(int value);
|
||||
void __cdecl SetAlphaFunction(D3D11_COMPARISON_FUNC value);
|
||||
void __cdecl SetReferenceAlpha(int value);
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -219,8 +230,8 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
AlphaTestEffect(AlphaTestEffect const&);
|
||||
AlphaTestEffect& operator= (AlphaTestEffect const&);
|
||||
AlphaTestEffect(AlphaTestEffect const&) DIRECTX_CTOR_DELETE
|
||||
AlphaTestEffect& operator= (AlphaTestEffect const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -235,9 +246,9 @@ namespace DirectX
|
|||
~DualTextureEffect();
|
||||
|
||||
// IEffect methods.
|
||||
void Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
|
||||
void GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
void __cdecl GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
|
||||
// Camera settings.
|
||||
void XM_CALLCONV SetWorld(FXMMATRIX value) override;
|
||||
|
@ -246,20 +257,20 @@ namespace DirectX
|
|||
|
||||
// Material settings.
|
||||
void XM_CALLCONV SetDiffuseColor(FXMVECTOR value);
|
||||
void SetAlpha(float value);
|
||||
void __cdecl SetAlpha(float value);
|
||||
|
||||
// Fog settings.
|
||||
void SetFogEnabled(bool value) override;
|
||||
void SetFogStart(float value) override;
|
||||
void SetFogEnd(float value) override;
|
||||
void __cdecl SetFogEnabled(bool value) override;
|
||||
void __cdecl SetFogStart(float value) override;
|
||||
void __cdecl SetFogEnd(float value) override;
|
||||
void XM_CALLCONV SetFogColor(FXMVECTOR value) override;
|
||||
|
||||
// Vertex color setting.
|
||||
void SetVertexColorEnabled(bool value);
|
||||
void __cdecl SetVertexColorEnabled(bool value);
|
||||
|
||||
// Texture settings.
|
||||
void SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void SetTexture2(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTexture2(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -268,8 +279,8 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
DualTextureEffect(DualTextureEffect const&);
|
||||
DualTextureEffect& operator= (DualTextureEffect const&);
|
||||
DualTextureEffect(DualTextureEffect const&) DIRECTX_CTOR_DELETE
|
||||
DualTextureEffect& operator= (DualTextureEffect const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -284,9 +295,9 @@ namespace DirectX
|
|||
virtual ~EnvironmentMapEffect();
|
||||
|
||||
// IEffect methods.
|
||||
void Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
|
||||
void GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
void __cdecl GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
|
||||
// Camera settings.
|
||||
void XM_CALLCONV SetWorld(FXMMATRIX value) override;
|
||||
|
@ -296,31 +307,31 @@ namespace DirectX
|
|||
// Material settings.
|
||||
void XM_CALLCONV SetDiffuseColor(FXMVECTOR value);
|
||||
void XM_CALLCONV SetEmissiveColor(FXMVECTOR value);
|
||||
void SetAlpha(float value);
|
||||
void __cdecl SetAlpha(float value);
|
||||
|
||||
// Light settings.
|
||||
void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override;
|
||||
|
||||
void SetLightEnabled(int whichLight, bool value) override;
|
||||
void __cdecl SetLightEnabled(int whichLight, bool value) override;
|
||||
void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) override;
|
||||
void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) override;
|
||||
|
||||
void EnableDefaultLighting() override;
|
||||
void __cdecl EnableDefaultLighting() override;
|
||||
|
||||
// Fog settings.
|
||||
void SetFogEnabled(bool value) override;
|
||||
void SetFogStart(float value) override;
|
||||
void SetFogEnd(float value) override;
|
||||
void __cdecl SetFogEnabled(bool value) override;
|
||||
void __cdecl SetFogStart(float value) override;
|
||||
void __cdecl SetFogEnd(float value) override;
|
||||
void XM_CALLCONV SetFogColor(FXMVECTOR value) override;
|
||||
|
||||
// Texture setting.
|
||||
void SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
|
||||
// Environment map settings.
|
||||
void SetEnvironmentMap(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void SetEnvironmentMapAmount(float value);
|
||||
void __cdecl SetEnvironmentMap(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetEnvironmentMapAmount(float value);
|
||||
void XM_CALLCONV SetEnvironmentMapSpecular(FXMVECTOR value);
|
||||
void SetFresnelFactor(float value);
|
||||
void __cdecl SetFresnelFactor(float value);
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -329,13 +340,13 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Unsupported interface methods.
|
||||
void SetLightingEnabled(bool value) override;
|
||||
void SetPerPixelLighting(bool value) override;
|
||||
void __cdecl SetLightingEnabled(bool value) override;
|
||||
void __cdecl SetPerPixelLighting(bool value) override;
|
||||
void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override;
|
||||
|
||||
// Prevent copying.
|
||||
EnvironmentMapEffect(EnvironmentMapEffect const&);
|
||||
EnvironmentMapEffect& operator= (EnvironmentMapEffect const&);
|
||||
EnvironmentMapEffect(EnvironmentMapEffect const&) DIRECTX_CTOR_DELETE
|
||||
EnvironmentMapEffect& operator= (EnvironmentMapEffect const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -350,9 +361,9 @@ namespace DirectX
|
|||
virtual ~SkinnedEffect();
|
||||
|
||||
// IEffect methods.
|
||||
void Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
|
||||
void GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
void __cdecl GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
|
||||
// Camera settings.
|
||||
void XM_CALLCONV SetWorld(FXMMATRIX value) override;
|
||||
|
@ -363,34 +374,34 @@ namespace DirectX
|
|||
void XM_CALLCONV SetDiffuseColor(FXMVECTOR value);
|
||||
void XM_CALLCONV SetEmissiveColor(FXMVECTOR value);
|
||||
void XM_CALLCONV SetSpecularColor(FXMVECTOR value);
|
||||
void SetSpecularPower(float value);
|
||||
void DisableSpecular();
|
||||
void SetAlpha(float value);
|
||||
void __cdecl SetSpecularPower(float value);
|
||||
void __cdecl DisableSpecular();
|
||||
void __cdecl SetAlpha(float value);
|
||||
|
||||
// Light settings.
|
||||
void SetPerPixelLighting(bool value) override;
|
||||
void __cdecl SetPerPixelLighting(bool value) override;
|
||||
void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override;
|
||||
|
||||
void SetLightEnabled(int whichLight, bool value) override;
|
||||
void __cdecl SetLightEnabled(int whichLight, bool value) override;
|
||||
void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) override;
|
||||
void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) override;
|
||||
void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override;
|
||||
|
||||
void EnableDefaultLighting() override;
|
||||
void __cdecl EnableDefaultLighting() override;
|
||||
|
||||
// Fog settings.
|
||||
void SetFogEnabled(bool value) override;
|
||||
void SetFogStart(float value) override;
|
||||
void SetFogEnd(float value) override;
|
||||
void __cdecl SetFogEnabled(bool value) override;
|
||||
void __cdecl SetFogStart(float value) override;
|
||||
void __cdecl SetFogEnd(float value) override;
|
||||
void XM_CALLCONV SetFogColor(FXMVECTOR value) override;
|
||||
|
||||
// Texture setting.
|
||||
void SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
|
||||
// Animation settings.
|
||||
void SetWeightsPerVertex(int value) override;
|
||||
void SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) override;
|
||||
void ResetBoneTransforms() override;
|
||||
void __cdecl SetWeightsPerVertex(int value) override;
|
||||
void __cdecl SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) override;
|
||||
void __cdecl ResetBoneTransforms() override;
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -399,11 +410,11 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Unsupported interface method.
|
||||
void SetLightingEnabled(bool value) override;
|
||||
void __cdecl SetLightingEnabled(bool value) override;
|
||||
|
||||
// Prevent copying.
|
||||
SkinnedEffect(SkinnedEffect const&);
|
||||
SkinnedEffect& operator= (SkinnedEffect const&);
|
||||
SkinnedEffect(SkinnedEffect const&) DIRECTX_CTOR_DELETE
|
||||
SkinnedEffect& operator= (SkinnedEffect const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -420,9 +431,9 @@ namespace DirectX
|
|||
virtual ~DGSLEffect();
|
||||
|
||||
// IEffect methods.
|
||||
void Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override;
|
||||
|
||||
void GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
void __cdecl GetVertexShaderBytecode(_Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override;
|
||||
|
||||
// Camera settings.
|
||||
void XM_CALLCONV SetWorld(FXMMATRIX value) override;
|
||||
|
@ -434,43 +445,44 @@ namespace DirectX
|
|||
void XM_CALLCONV SetDiffuseColor(FXMVECTOR value);
|
||||
void XM_CALLCONV SetEmissiveColor(FXMVECTOR value);
|
||||
void XM_CALLCONV SetSpecularColor(FXMVECTOR value);
|
||||
void SetSpecularPower(float value);
|
||||
void DisableSpecular();
|
||||
void SetAlpha(float value);
|
||||
void __cdecl SetSpecularPower(float value);
|
||||
void __cdecl DisableSpecular();
|
||||
void __cdecl SetAlpha(float value);
|
||||
|
||||
// Additional settings.
|
||||
void XM_CALLCONV SetUVTransform(FXMMATRIX value);
|
||||
void SetViewport( float width, float height );
|
||||
void SetTime( float time );
|
||||
void SetAlphaDiscardEnable(bool value);
|
||||
void __cdecl SetViewport( float width, float height );
|
||||
void __cdecl SetTime( float time );
|
||||
void __cdecl SetAlphaDiscardEnable(bool value);
|
||||
|
||||
// Light settings.
|
||||
void SetLightingEnabled(bool value) override;
|
||||
void __cdecl SetLightingEnabled(bool value) override;
|
||||
void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override;
|
||||
|
||||
void SetLightEnabled(int whichLight, bool value) override;
|
||||
void __cdecl SetLightEnabled(int whichLight, bool value) override;
|
||||
void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) override;
|
||||
void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) override;
|
||||
void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override;
|
||||
|
||||
void EnableDefaultLighting() override;
|
||||
void __cdecl EnableDefaultLighting() override;
|
||||
|
||||
static const int MaxDirectionalLights = 4;
|
||||
|
||||
// Vertex color setting.
|
||||
void SetVertexColorEnabled(bool value);
|
||||
void __cdecl SetVertexColorEnabled(bool value);
|
||||
|
||||
// Texture settings.
|
||||
void SetTextureEnabled(bool value);
|
||||
void SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void SetTexture(int whichTexture, _In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTextureEnabled(bool value);
|
||||
void __cdecl SetTexture(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTexture2(_In_opt_ ID3D11ShaderResourceView* value);
|
||||
void __cdecl SetTexture(int whichTexture, _In_opt_ ID3D11ShaderResourceView* value);
|
||||
|
||||
static const int MaxTextures = 8;
|
||||
|
||||
// Animation setting.
|
||||
void SetWeightsPerVertex(int value) override;
|
||||
void SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) override;
|
||||
void ResetBoneTransforms() override;
|
||||
void __cdecl SetWeightsPerVertex(int value) override;
|
||||
void __cdecl SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) override;
|
||||
void __cdecl ResetBoneTransforms() override;
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -479,11 +491,11 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Unsupported interface methods.
|
||||
void SetPerPixelLighting(bool value) override;
|
||||
void __cdecl SetPerPixelLighting(bool value) override;
|
||||
|
||||
// Prevent copying.
|
||||
DGSLEffect(DGSLEffect const&);
|
||||
DGSLEffect& operator= (DGSLEffect const&);
|
||||
DGSLEffect(DGSLEffect const&) DIRECTX_CTOR_DELETE
|
||||
DGSLEffect& operator= (DGSLEffect const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -500,6 +512,7 @@ namespace DirectX
|
|||
const WCHAR* name;
|
||||
bool perVertexColor;
|
||||
bool enableSkinning;
|
||||
bool enableDualTexture;
|
||||
float specularPower;
|
||||
float alpha;
|
||||
DirectX::XMFLOAT3 ambientColor;
|
||||
|
@ -507,13 +520,14 @@ namespace DirectX
|
|||
DirectX::XMFLOAT3 specularColor;
|
||||
DirectX::XMFLOAT3 emissiveColor;
|
||||
const WCHAR* texture;
|
||||
const WCHAR* texture2;
|
||||
|
||||
EffectInfo() { memset( this, 0, sizeof(EffectInfo) ); };
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<IEffect> CreateEffect( _In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext ) = 0;
|
||||
virtual std::shared_ptr<IEffect> __cdecl CreateEffect( _In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext ) = 0;
|
||||
|
||||
virtual void CreateTexture( _In_z_ const WCHAR* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView ) = 0;
|
||||
virtual void __cdecl CreateTexture( _In_z_ const WCHAR* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -527,15 +541,15 @@ namespace DirectX
|
|||
virtual ~EffectFactory();
|
||||
|
||||
// IEffectFactory methods.
|
||||
virtual std::shared_ptr<IEffect> CreateEffect( _In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext ) override;
|
||||
virtual void CreateTexture( _In_z_ const WCHAR* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView ) override;
|
||||
virtual std::shared_ptr<IEffect> __cdecl CreateEffect( _In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext ) override;
|
||||
virtual void __cdecl CreateTexture( _In_z_ const WCHAR* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView ) override;
|
||||
|
||||
// Settings.
|
||||
void ReleaseCache();
|
||||
void __cdecl ReleaseCache();
|
||||
|
||||
void SetSharing( bool enabled );
|
||||
void __cdecl SetSharing( bool enabled );
|
||||
|
||||
void SetDirectory( _In_opt_z_ const WCHAR* path );
|
||||
void __cdecl SetDirectory( _In_opt_z_ const WCHAR* path );
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -544,8 +558,8 @@ namespace DirectX
|
|||
std::shared_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
EffectFactory(EffectFactory const&);
|
||||
EffectFactory& operator= (EffectFactory const&);
|
||||
EffectFactory(EffectFactory const&) DIRECTX_CTOR_DELETE
|
||||
EffectFactory& operator= (EffectFactory const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
|
||||
|
@ -559,28 +573,28 @@ namespace DirectX
|
|||
virtual ~DGSLEffectFactory();
|
||||
|
||||
// IEffectFactory methods.
|
||||
virtual std::shared_ptr<IEffect> CreateEffect( _In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext ) override;
|
||||
virtual void CreateTexture( _In_z_ const WCHAR* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView ) override;
|
||||
virtual std::shared_ptr<IEffect> __cdecl CreateEffect( _In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext ) override;
|
||||
virtual void __cdecl CreateTexture( _In_z_ const WCHAR* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView ) override;
|
||||
|
||||
// DGSL methods.
|
||||
struct DGSLEffectInfo : public EffectInfo
|
||||
{
|
||||
const WCHAR* textures[7];
|
||||
const WCHAR* textures[6];
|
||||
const WCHAR* pixelShader;
|
||||
|
||||
DGSLEffectInfo() { memset( this, 0, sizeof(DGSLEffectInfo) ); };
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<IEffect> CreateDGSLEffect( _In_ const DGSLEffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext );
|
||||
virtual std::shared_ptr<IEffect> __cdecl CreateDGSLEffect( _In_ const DGSLEffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext );
|
||||
|
||||
virtual void CreatePixelShader( _In_z_ const WCHAR* shader, _Outptr_ ID3D11PixelShader** pixelShader );
|
||||
virtual void __cdecl CreatePixelShader( _In_z_ const WCHAR* shader, _Outptr_ ID3D11PixelShader** pixelShader );
|
||||
|
||||
// Settings.
|
||||
void ReleaseCache();
|
||||
void __cdecl ReleaseCache();
|
||||
|
||||
void SetSharing( bool enabled );
|
||||
void __cdecl SetSharing( bool enabled );
|
||||
|
||||
void SetDirectory( _In_opt_z_ const WCHAR* path );
|
||||
void __cdecl SetDirectory( _In_opt_z_ const WCHAR* path );
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -589,8 +603,8 @@ namespace DirectX
|
|||
std::shared_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
DGSLEffectFactory(DGSLEffectFactory const&);
|
||||
DGSLEffectFactory& operator= (DGSLEffectFactory const&);
|
||||
DGSLEffectFactory(DGSLEffectFactory const&) DIRECTX_CTOR_DELETE
|
||||
DGSLEffectFactory& operator= (DGSLEffectFactory const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
|
||||
}
|
||||
|
|
244
Windows/DirectXTK/GamePad.h
Normal file
244
Windows/DirectXTK/GamePad.h
Normal file
|
@ -0,0 +1,244 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// File: GamePad.h
|
||||
//
|
||||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||
// PARTICULAR PURPOSE.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#if (_WIN32_WINNT < 0x0A00 /*_WIN32_WINNT_WIN10*/)
|
||||
#ifndef _XBOX_ONE
|
||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
|
||||
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/ )
|
||||
#pragma comment(lib,"xinput.lib")
|
||||
#else
|
||||
#pragma comment(lib,"xinput9_1_0.lib")
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4005)
|
||||
#include <stdint.h>
|
||||
#include <intsafe.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
class GamePad
|
||||
{
|
||||
public:
|
||||
GamePad();
|
||||
GamePad(GamePad&& moveFrom);
|
||||
GamePad& operator= (GamePad&& moveFrom);
|
||||
virtual ~GamePad();
|
||||
|
||||
#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ ) || defined(_XBOX_ONE)
|
||||
static const int MAX_PLAYER_COUNT = 8;
|
||||
#else
|
||||
static const int MAX_PLAYER_COUNT = 4;
|
||||
#endif
|
||||
|
||||
enum DeadZone
|
||||
{
|
||||
DEAD_ZONE_INDEPENDENT_AXES = 0,
|
||||
DEAD_ZONE_CIRCULAR,
|
||||
DEAD_ZONE_NONE,
|
||||
};
|
||||
|
||||
struct Buttons
|
||||
{
|
||||
bool a;
|
||||
bool b;
|
||||
bool x;
|
||||
bool y;
|
||||
bool leftStick;
|
||||
bool rightStick;
|
||||
bool leftShoulder;
|
||||
bool rightShoulder;
|
||||
bool back;
|
||||
bool start;
|
||||
};
|
||||
|
||||
struct DPad
|
||||
{
|
||||
bool up;
|
||||
bool down;
|
||||
bool right;
|
||||
bool left;
|
||||
};
|
||||
|
||||
struct ThumbSticks
|
||||
{
|
||||
float leftX;
|
||||
float leftY;
|
||||
float rightX;
|
||||
float rightY;
|
||||
};
|
||||
|
||||
struct Triggers
|
||||
{
|
||||
float left;
|
||||
float right;
|
||||
};
|
||||
|
||||
struct State
|
||||
{
|
||||
bool connected;
|
||||
uint64_t packet;
|
||||
Buttons buttons;
|
||||
DPad dpad;
|
||||
ThumbSticks thumbSticks;
|
||||
Triggers triggers;
|
||||
|
||||
bool __cdecl IsConnected() const { return connected; }
|
||||
|
||||
// Is the button pressed currently?
|
||||
bool __cdecl IsAPressed() const { return buttons.a; }
|
||||
bool __cdecl IsBPressed() const { return buttons.b; }
|
||||
bool __cdecl IsXPressed() const { return buttons.x; }
|
||||
bool __cdecl IsYPressed() const { return buttons.y; }
|
||||
|
||||
bool __cdecl IsLeftStickPressed() const { return buttons.leftStick; }
|
||||
bool __cdecl IsRightStickPressed() const { return buttons.rightStick; }
|
||||
|
||||
bool __cdecl IsLeftShoulderPressed() const { return buttons.leftShoulder; }
|
||||
bool __cdecl IsRightShoulderPressed() const { return buttons.rightShoulder; }
|
||||
|
||||
bool __cdecl IsBackPressed() const { return buttons.back; }
|
||||
bool __cdecl IsViewPressed() const { return buttons.back; }
|
||||
bool __cdecl IsStartPressed() const { return buttons.start; }
|
||||
bool __cdecl IsMenuPressed() const { return buttons.start; }
|
||||
|
||||
bool __cdecl IsDPadDownPressed() const { return dpad.down; };
|
||||
bool __cdecl IsDPadUpPressed() const { return dpad.up; };
|
||||
bool __cdecl IsDPadLeftPressed() const { return dpad.left; };
|
||||
bool __cdecl IsDPadRightPressed() const { return dpad.right; };
|
||||
|
||||
bool __cdecl IsLeftThumbStickUp() const { return (thumbSticks.leftY > 0.5f) != 0; }
|
||||
bool __cdecl IsLeftThumbStickDown() const { return (thumbSticks.leftY < -0.5f) != 0; }
|
||||
bool __cdecl IsLeftThumbStickLeft() const { return (thumbSticks.leftX < -0.5f) != 0; }
|
||||
bool __cdecl IsLeftThumbStickRight() const { return (thumbSticks.leftX > 0.5f) != 0; }
|
||||
|
||||
bool __cdecl IsRightThumbStickUp() const { return (thumbSticks.rightY > 0.5f ) != 0; }
|
||||
bool __cdecl IsRightThumbStickDown() const { return (thumbSticks.rightY < -0.5f) != 0; }
|
||||
bool __cdecl IsRightThumbStickLeft() const { return (thumbSticks.rightX < -0.5f) != 0; }
|
||||
bool __cdecl IsRightThumbStickRight() const { return (thumbSticks.rightX > 0.5f) != 0; }
|
||||
|
||||
bool __cdecl IsLeftTriggerPressed() const { return (triggers.left > 0.5f) != 0; }
|
||||
bool __cdecl IsRightTriggerPressed() const { return (triggers.right > 0.5f) != 0; }
|
||||
};
|
||||
|
||||
struct Capabilities
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
GAMEPAD,
|
||||
WHEEL,
|
||||
ARCADE_STICK,
|
||||
FLIGHT_STICK,
|
||||
DANCE_PAD,
|
||||
GUITAR,
|
||||
GUITAR_ALTERNATE,
|
||||
DRUM_KIT,
|
||||
GUITAR_BASS = 11,
|
||||
ARCADE_PAD = 19,
|
||||
};
|
||||
|
||||
bool connected;
|
||||
Type gamepadType;
|
||||
uint64_t id;
|
||||
|
||||
bool __cdecl IsConnected() const { return connected; }
|
||||
};
|
||||
|
||||
class ButtonStateTracker
|
||||
{
|
||||
public:
|
||||
enum ButtonState
|
||||
{
|
||||
UP = 0, // Button is up
|
||||
HELD = 1, // Button is held down
|
||||
RELEASED = 2, // Button was just released
|
||||
PRESSED = 3, // Buton was just pressed
|
||||
};
|
||||
|
||||
ButtonState a;
|
||||
ButtonState b;
|
||||
ButtonState x;
|
||||
ButtonState y;
|
||||
|
||||
ButtonState leftStick;
|
||||
ButtonState rightStick;
|
||||
|
||||
ButtonState leftShoulder;
|
||||
ButtonState rightShoulder;
|
||||
|
||||
ButtonState back;
|
||||
ButtonState start;
|
||||
|
||||
ButtonState dpadUp;
|
||||
ButtonState dpadDown;
|
||||
ButtonState dpadLeft;
|
||||
ButtonState dpadRight;
|
||||
|
||||
ButtonStateTracker() { Reset(); }
|
||||
|
||||
void __cdecl Update( const State& state );
|
||||
|
||||
void __cdecl Reset();
|
||||
|
||||
private:
|
||||
State lastState;
|
||||
};
|
||||
|
||||
// Retrieve the current state of the gamepad of the associated player index
|
||||
State __cdecl GetState(int player, DeadZone deadZoneMode = DEAD_ZONE_INDEPENDENT_AXES);
|
||||
|
||||
// Retrieve the current capabilities of the gamepad of the associated player index
|
||||
Capabilities __cdecl GetCapabilities(int player);
|
||||
|
||||
// Set the vibration motor speeds of the gamepad
|
||||
bool __cdecl SetVibration( int player, float leftMotor, float rightMotor, float leftTrigger = 0.f, float rightTrigger = 0.f );
|
||||
|
||||
// Handle suspending/resuming
|
||||
void __cdecl Suspend();
|
||||
void __cdecl Resume();
|
||||
|
||||
// Singleton
|
||||
static GamePad& __cdecl Get();
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
class Impl;
|
||||
|
||||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
GamePad(GamePad const&) DIRECTX_CTOR_DELETE
|
||||
GamePad& operator=(GamePad const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
|
@ -13,21 +13,37 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
#include "VertexTypes.h"
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <DirectXColors.h>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// VS 2010 doesn't support explicit calling convention for std::function
|
||||
#ifndef DIRECTX_STD_CALLCONV
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
#define DIRECTX_STD_CALLCONV
|
||||
#else
|
||||
#define DIRECTX_STD_CALLCONV __cdecl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
#if (DIRECTXMATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#define XM_CALLCONV __fastcall
|
||||
typedef const XMVECTOR& HXMVECTOR;
|
||||
typedef const XMMATRIX& FXMMATRIX;
|
||||
|
@ -38,29 +54,46 @@ namespace DirectX
|
|||
class GeometricPrimitive
|
||||
{
|
||||
public:
|
||||
~GeometricPrimitive();
|
||||
virtual ~GeometricPrimitive();
|
||||
|
||||
// Factory methods.
|
||||
static std::unique_ptr<GeometricPrimitive> CreateCube (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateSphere (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 16, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateGeoSphere (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 3, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateCylinder (_In_ ID3D11DeviceContext* deviceContext, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateCone (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateTorus (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateTetrahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateOctahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateDodecahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateIcosahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> CreateTeapot (_In_ ID3D11DeviceContext* deviceContext, float size = 1, size_t tessellation = 8, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCube (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateBox (_In_ ID3D11DeviceContext* deviceContext, const XMFLOAT3& size, bool rhcoords = true, bool invertn = false);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateSphere (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateGeoSphere (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 3, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCylinder (_In_ ID3D11DeviceContext* deviceContext, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCone (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateTorus (_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateTetrahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateOctahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateDodecahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateIcosahedron (_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateTeapot (_In_ ID3D11DeviceContext* deviceContext, float size = 1, size_t tessellation = 8, bool rhcoords = true);
|
||||
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCustom (_In_ ID3D11DeviceContext* deviceContext, const std::vector<VertexPositionNormalTexture>& vertices, const std::vector<uint16_t>& indices);
|
||||
|
||||
static void __cdecl CreateCube (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float size = 1, bool rhcoords = true);
|
||||
static void __cdecl CreateBox (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, const XMFLOAT3& size, bool rhcoords = true, bool invertn = false);
|
||||
static void __cdecl CreateSphere (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false);
|
||||
static void __cdecl CreateGeoSphere (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float diameter = 1, size_t tessellation = 3, bool rhcoords = true);
|
||||
static void __cdecl CreateCylinder (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true);
|
||||
static void __cdecl CreateCone (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true);
|
||||
static void __cdecl CreateTorus (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true);
|
||||
static void __cdecl CreateTetrahedron (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float size = 1, bool rhcoords = true);
|
||||
static void __cdecl CreateOctahedron (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float size = 1, bool rhcoords = true);
|
||||
static void __cdecl CreateDodecahedron (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float size = 1, bool rhcoords = true);
|
||||
static void __cdecl CreateIcosahedron (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float size = 1, bool rhcoords = true);
|
||||
static void __cdecl CreateTeapot (std::vector<VertexPositionNormalTexture>& vertices, std::vector<uint16_t>& indices, float size = 1, size_t tessellation = 8, bool rhcoords = true);
|
||||
|
||||
// Draw the primitive.
|
||||
void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, FXMVECTOR color = Colors::White, _In_opt_ ID3D11ShaderResourceView* texture = nullptr, bool wireframe = false, _In_opt_ std::function<void()> setCustomState = nullptr);
|
||||
void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, FXMVECTOR color = Colors::White, _In_opt_ ID3D11ShaderResourceView* texture = nullptr, bool wireframe = false,
|
||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr );
|
||||
|
||||
// Draw the primitive using a custom effect.
|
||||
void Draw( _In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha = false, bool wireframe = false, _In_opt_ std::function<void()> setCustomState = nullptr );
|
||||
void __cdecl Draw( _In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha = false, bool wireframe = false,
|
||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr );
|
||||
|
||||
// Create input layout for drawing with a custom effect.
|
||||
void CreateInputLayout( _In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout );
|
||||
void __cdecl CreateInputLayout( _In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout );
|
||||
|
||||
private:
|
||||
GeometricPrimitive();
|
||||
|
@ -71,7 +104,7 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
GeometricPrimitive(GeometricPrimitive const&);
|
||||
GeometricPrimitive& operator= (GeometricPrimitive const&);
|
||||
GeometricPrimitive(GeometricPrimitive const&) DIRECTX_CTOR_DELETE
|
||||
GeometricPrimitive& operator= (GeometricPrimitive const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
||||
|
|
67
Windows/DirectXTK/GraphicsMemory.h
Normal file
67
Windows/DirectXTK/GraphicsMemory.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// File: GraphicsMemory.h
|
||||
//
|
||||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||
// PARTICULAR PURPOSE.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
class GraphicsMemory
|
||||
{
|
||||
public:
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
GraphicsMemory(_In_ ID3D11DeviceX* device, UINT backBufferCount = 2);
|
||||
#else
|
||||
GraphicsMemory(_In_ ID3D11Device* device, UINT backBufferCount = 2);
|
||||
#endif
|
||||
GraphicsMemory(GraphicsMemory&& moveFrom);
|
||||
GraphicsMemory& operator= (GraphicsMemory&& moveFrom);
|
||||
virtual ~GraphicsMemory();
|
||||
|
||||
void* __cdecl Allocate(_In_opt_ ID3D11DeviceContext* context, size_t size, int alignment);
|
||||
|
||||
void __cdecl Commit();
|
||||
|
||||
// Singleton
|
||||
static GraphicsMemory& __cdecl Get();
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
class Impl;
|
||||
|
||||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
GraphicsMemory(GraphicsMemory const&) DIRECTX_CTOR_DELETE
|
||||
GraphicsMemory& operator=(GraphicsMemory const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
492
Windows/DirectXTK/Keyboard.h
Normal file
492
Windows/DirectXTK/Keyboard.h
Normal file
|
@ -0,0 +1,492 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// File: Keyboard.h
|
||||
//
|
||||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||
// PARTICULAR PURPOSE.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4005)
|
||||
#include <stdint.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
#include <memory>
|
||||
|
||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||
namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } }
|
||||
#endif
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
class Keyboard
|
||||
{
|
||||
public:
|
||||
Keyboard();
|
||||
Keyboard(Keyboard&& moveFrom);
|
||||
Keyboard& operator= (Keyboard&& moveFrom);
|
||||
virtual ~Keyboard();
|
||||
|
||||
enum Keys
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Back = 0x8,
|
||||
Tab = 0x9,
|
||||
|
||||
Enter = 0xd,
|
||||
|
||||
Pause = 0x13,
|
||||
CapsLock = 0x14,
|
||||
Kana = 0x15,
|
||||
|
||||
Kanji = 0x19,
|
||||
|
||||
Escape = 0x1b,
|
||||
ImeConvert = 0x1c,
|
||||
ImeNoConvert = 0x1d,
|
||||
|
||||
Space = 0x20,
|
||||
PageUp = 0x21,
|
||||
PageDown = 0x22,
|
||||
End = 0x23,
|
||||
Home = 0x24,
|
||||
Left = 0x25,
|
||||
Up = 0x26,
|
||||
Right = 0x27,
|
||||
Down = 0x28,
|
||||
Select = 0x29,
|
||||
Print = 0x2a,
|
||||
Execute = 0x2b,
|
||||
PrintScreen = 0x2c,
|
||||
Insert = 0x2d,
|
||||
Delete = 0x2e,
|
||||
Help = 0x2f,
|
||||
D0 = 0x30,
|
||||
D1 = 0x31,
|
||||
D2 = 0x32,
|
||||
D3 = 0x33,
|
||||
D4 = 0x34,
|
||||
D5 = 0x35,
|
||||
D6 = 0x36,
|
||||
D7 = 0x37,
|
||||
D8 = 0x38,
|
||||
D9 = 0x39,
|
||||
|
||||
A = 0x41,
|
||||
B = 0x42,
|
||||
C = 0x43,
|
||||
D = 0x44,
|
||||
E = 0x45,
|
||||
F = 0x46,
|
||||
G = 0x47,
|
||||
H = 0x48,
|
||||
I = 0x49,
|
||||
J = 0x4a,
|
||||
K = 0x4b,
|
||||
L = 0x4c,
|
||||
M = 0x4d,
|
||||
N = 0x4e,
|
||||
O = 0x4f,
|
||||
P = 0x50,
|
||||
Q = 0x51,
|
||||
R = 0x52,
|
||||
S = 0x53,
|
||||
T = 0x54,
|
||||
U = 0x55,
|
||||
V = 0x56,
|
||||
W = 0x57,
|
||||
X = 0x58,
|
||||
Y = 0x59,
|
||||
Z = 0x5a,
|
||||
LeftWindows = 0x5b,
|
||||
RightWindows = 0x5c,
|
||||
Apps = 0x5d,
|
||||
|
||||
Sleep = 0x5f,
|
||||
NumPad0 = 0x60,
|
||||
NumPad1 = 0x61,
|
||||
NumPad2 = 0x62,
|
||||
NumPad3 = 0x63,
|
||||
NumPad4 = 0x64,
|
||||
NumPad5 = 0x65,
|
||||
NumPad6 = 0x66,
|
||||
NumPad7 = 0x67,
|
||||
NumPad8 = 0x68,
|
||||
NumPad9 = 0x69,
|
||||
Multiply = 0x6a,
|
||||
Add = 0x6b,
|
||||
Separator = 0x6c,
|
||||
Subtract = 0x6d,
|
||||
|
||||
Decimal = 0x6e,
|
||||
Divide = 0x6f,
|
||||
F1 = 0x70,
|
||||
F2 = 0x71,
|
||||
F3 = 0x72,
|
||||
F4 = 0x73,
|
||||
F5 = 0x74,
|
||||
F6 = 0x75,
|
||||
F7 = 0x76,
|
||||
F8 = 0x77,
|
||||
F9 = 0x78,
|
||||
F10 = 0x79,
|
||||
F11 = 0x7a,
|
||||
F12 = 0x7b,
|
||||
F13 = 0x7c,
|
||||
F14 = 0x7d,
|
||||
F15 = 0x7e,
|
||||
F16 = 0x7f,
|
||||
F17 = 0x80,
|
||||
F18 = 0x81,
|
||||
F19 = 0x82,
|
||||
F20 = 0x83,
|
||||
F21 = 0x84,
|
||||
F22 = 0x85,
|
||||
F23 = 0x86,
|
||||
F24 = 0x87,
|
||||
|
||||
NumLock = 0x90,
|
||||
Scroll = 0x91,
|
||||
|
||||
LeftShift = 0xa0,
|
||||
RightShift = 0xa1,
|
||||
LeftControl = 0xa2,
|
||||
RightControl = 0xa3,
|
||||
LeftAlt = 0xa4,
|
||||
RightAlt = 0xa5,
|
||||
BrowserBack = 0xa6,
|
||||
BrowserForward = 0xa7,
|
||||
BrowserRefresh = 0xa8,
|
||||
BrowserStop = 0xa9,
|
||||
BrowserSearch = 0xaa,
|
||||
BrowserFavorites = 0xab,
|
||||
BrowserHome = 0xac,
|
||||
VolumeMute = 0xad,
|
||||
VolumeDown = 0xae,
|
||||
VolumeUp = 0xaf,
|
||||
MediaNextTrack = 0xb0,
|
||||
MediaPreviousTrack = 0xb1,
|
||||
MediaStop = 0xb2,
|
||||
MediaPlayPause = 0xb3,
|
||||
LaunchMail = 0xb4,
|
||||
SelectMedia = 0xb5,
|
||||
LaunchApplication1 = 0xb6,
|
||||
LaunchApplication2 = 0xb7,
|
||||
|
||||
OemSemicolon = 0xba,
|
||||
OemPlus = 0xbb,
|
||||
OemComma = 0xbc,
|
||||
OemMinus = 0xbd,
|
||||
OemPeriod = 0xbe,
|
||||
OemQuestion = 0xbf,
|
||||
OemTilde = 0xc0,
|
||||
|
||||
OemOpenBrackets = 0xdb,
|
||||
OemPipe = 0xdc,
|
||||
OemCloseBrackets = 0xdd,
|
||||
OemQuotes = 0xde,
|
||||
Oem8 = 0xdf,
|
||||
|
||||
OemBackslash = 0xe2,
|
||||
|
||||
ProcessKey = 0xe5,
|
||||
|
||||
OemCopy = 0xf2,
|
||||
OemAuto = 0xf3,
|
||||
OemEnlW = 0xf4,
|
||||
|
||||
Attn = 0xf6,
|
||||
Crsel = 0xf7,
|
||||
Exsel = 0xf8,
|
||||
EraseEof = 0xf9,
|
||||
Play = 0xfa,
|
||||
Zoom = 0xfb,
|
||||
|
||||
Pa1 = 0xfd,
|
||||
OemClear = 0xfe,
|
||||
};
|
||||
|
||||
struct State
|
||||
{
|
||||
bool Reserved0 : 8;
|
||||
bool Back : 1; // VK_BACK, 0x8
|
||||
bool Tab : 1; // VK_TAB, 0x9
|
||||
bool Reserved1 : 3;
|
||||
bool Enter : 1; // VK_RETURN, 0xD
|
||||
bool Reserved2 : 2;
|
||||
bool Reserved3 : 3;
|
||||
bool Pause : 1; // VK_PAUSE, 0x13
|
||||
bool CapsLock : 1; // VK_CAPITAL, 0x14
|
||||
bool Kana : 1; // VK_KANA, 0x15
|
||||
bool Reserved4 : 2;
|
||||
bool Reserved5 : 1;
|
||||
bool Kanji : 1; // VK_KANJI, 0x19
|
||||
bool Reserved6 : 1;
|
||||
bool Escape : 1; // VK_ESCAPE, 0x1B
|
||||
bool ImeConvert : 1; // VK_CONVERT, 0x1C
|
||||
bool ImeNoConvert : 1; // VK_NONCONVERT, 0x1D
|
||||
bool Reserved7 : 2;
|
||||
bool Space : 1; // VK_SPACE, 0x20
|
||||
bool PageUp : 1; // VK_PRIOR, 0x21
|
||||
bool PageDown : 1; // VK_NEXT, 0x22
|
||||
bool End : 1; // VK_END, 0x23
|
||||
bool Home : 1; // VK_HOME, 0x24
|
||||
bool Left : 1; // VK_LEFT, 0x25
|
||||
bool Up : 1; // VK_UP, 0x26
|
||||
bool Right : 1; // VK_RIGHT, 0x27
|
||||
bool Down : 1; // VK_DOWN, 0x28
|
||||
bool Select : 1; // VK_SELECT, 0x29
|
||||
bool Print : 1; // VK_PRINT, 0x2A
|
||||
bool Execute : 1; // VK_EXECUTE, 0x2B
|
||||
bool PrintScreen : 1; // VK_SNAPSHOT, 0x2C
|
||||
bool Insert : 1; // VK_INSERT, 0x2D
|
||||
bool Delete : 1; // VK_DELETE, 0x2E
|
||||
bool Help : 1; // VK_HELP, 0x2F
|
||||
bool D0 : 1; // 0x30
|
||||
bool D1 : 1; // 0x31
|
||||
bool D2 : 1; // 0x32
|
||||
bool D3 : 1; // 0x33
|
||||
bool D4 : 1; // 0x34
|
||||
bool D5 : 1; // 0x35
|
||||
bool D6 : 1; // 0x36
|
||||
bool D7 : 1; // 0x37
|
||||
bool D8 : 1; // 0x38
|
||||
bool D9 : 1; // 0x39
|
||||
bool Reserved8 : 6;
|
||||
bool Reserved9 : 1;
|
||||
bool A : 1; // 0x41
|
||||
bool B : 1; // 0x42
|
||||
bool C : 1; // 0x43
|
||||
bool D : 1; // 0x44
|
||||
bool E : 1; // 0x45
|
||||
bool F : 1; // 0x46
|
||||
bool G : 1; // 0x47
|
||||
bool H : 1; // 0x48
|
||||
bool I : 1; // 0x49
|
||||
bool J : 1; // 0x4A
|
||||
bool K : 1; // 0x4B
|
||||
bool L : 1; // 0x4C
|
||||
bool M : 1; // 0x4D
|
||||
bool N : 1; // 0x4E
|
||||
bool O : 1; // 0x4F
|
||||
bool P : 1; // 0x50
|
||||
bool Q : 1; // 0x51
|
||||
bool R : 1; // 0x52
|
||||
bool S : 1; // 0x53
|
||||
bool T : 1; // 0x54
|
||||
bool U : 1; // 0x55
|
||||
bool V : 1; // 0x56
|
||||
bool W : 1; // 0x57
|
||||
bool X : 1; // 0x58
|
||||
bool Y : 1; // 0x59
|
||||
bool Z : 1; // 0x5A
|
||||
bool LeftWindows : 1; // VK_LWIN, 0x5B
|
||||
bool RightWindows : 1; // VK_RWIN, 0x5C
|
||||
bool Apps : 1; // VK_APPS, 0x5D
|
||||
bool Reserved10 : 1;
|
||||
bool Sleep : 1; // VK_SLEEP, 0x5F
|
||||
bool NumPad0 : 1; // VK_NUMPAD0, 0x60
|
||||
bool NumPad1 : 1; // VK_NUMPAD1, 0x61
|
||||
bool NumPad2 : 1; // VK_NUMPAD2, 0x62
|
||||
bool NumPad3 : 1; // VK_NUMPAD3, 0x63
|
||||
bool NumPad4 : 1; // VK_NUMPAD4, 0x64
|
||||
bool NumPad5 : 1; // VK_NUMPAD5, 0x65
|
||||
bool NumPad6 : 1; // VK_NUMPAD6, 0x66
|
||||
bool NumPad7 : 1; // VK_NUMPAD7, 0x67
|
||||
bool NumPad8 : 1; // VK_NUMPAD8, 0x68
|
||||
bool NumPad9 : 1; // VK_NUMPAD9, 0x69
|
||||
bool Multiply : 1; // VK_MULTIPLY, 0x6A
|
||||
bool Add : 1; // VK_ADD, 0x6B
|
||||
bool Separator : 1; // VK_SEPARATOR, 0x6C
|
||||
bool Subtract : 1; // VK_SUBTRACT, 0x6D
|
||||
bool Decimal : 1; // VK_DECIMANL, 0x6E
|
||||
bool Divide : 1; // VK_DIVIDE, 0x6F
|
||||
bool F1 : 1; // VK_F1, 0x70
|
||||
bool F2 : 1; // VK_F2, 0x71
|
||||
bool F3 : 1; // VK_F3, 0x72
|
||||
bool F4 : 1; // VK_F4, 0x73
|
||||
bool F5 : 1; // VK_F5, 0x74
|
||||
bool F6 : 1; // VK_F6, 0x75
|
||||
bool F7 : 1; // VK_F7, 0x76
|
||||
bool F8 : 1; // VK_F8, 0x77
|
||||
bool F9 : 1; // VK_F9, 0x78
|
||||
bool F10 : 1; // VK_F10, 0x79
|
||||
bool F11 : 1; // VK_F11, 0x7A
|
||||
bool F12 : 1; // VK_F12, 0x7B
|
||||
bool F13 : 1; // VK_F13, 0x7C
|
||||
bool F14 : 1; // VK_F14, 0x7D
|
||||
bool F15 : 1; // VK_F15, 0x7E
|
||||
bool F16 : 1; // VK_F16, 0x7F
|
||||
bool F17 : 1; // VK_F17, 0x80
|
||||
bool F18 : 1; // VK_F18, 0x81
|
||||
bool F19 : 1; // VK_F19, 0x82
|
||||
bool F20 : 1; // VK_F20, 0x83
|
||||
bool F21 : 1; // VK_F21, 0x84
|
||||
bool F22 : 1; // VK_F22, 0x85
|
||||
bool F23 : 1; // VK_F23, 0x86
|
||||
bool F24 : 1; // VK_F24, 0x87
|
||||
bool Reserved11 : 8;
|
||||
bool NumLock : 1; // VK_NUMLOCK, 0x90
|
||||
bool Scroll : 1; // VK_SCROLL, 0x91
|
||||
bool Reserved12 : 6;
|
||||
bool Reserved13 : 8;
|
||||
bool LeftShift : 1; // VK_LSHIFT, 0xA0
|
||||
bool RightShift : 1; // VK_RSHIFT, 0xA1
|
||||
bool LeftControl : 1; // VK_LCONTROL, 0xA2
|
||||
bool RightControl : 1; // VK_RCONTROL, 0xA3
|
||||
bool LeftAlt : 1; // VK_LMENU, 0xA4
|
||||
bool RightAlt : 1; // VK_RMENU, 0xA5
|
||||
bool BrowserBack : 1; // VK_BROWSER_BACK, 0xA6
|
||||
bool BrowserForward : 1; // VK_BROWSER_FORWARD, 0xA7
|
||||
bool BrowserRefresh : 1; // VK_BROWSER_REFRESH, 0xA8
|
||||
bool BrowserStop : 1; // VK_BROWSER_STOP, 0xA9
|
||||
bool BrowserSearch : 1; // VK_BROWSER_SEARCH, 0xAA
|
||||
bool BrowserFavorites : 1; // VK_BROWSER_FAVORITES, 0xAB
|
||||
bool BrowserHome : 1; // VK_BROWSER_HOME, 0xAC
|
||||
bool VolumeMute : 1; // VK_VOLUME_MUTE, 0xAD
|
||||
bool VolumeDown : 1; // VK_VOLUME_DOWN, 0xAE
|
||||
bool VolumeUp : 1; // VK_VOLUME_UP, 0xAF
|
||||
bool MediaNextTrack : 1; // VK_MEDIA_NEXT_TRACK, 0xB0
|
||||
bool MediaPreviousTrack : 1;// VK_MEDIA_PREV_TRACK, 0xB1
|
||||
bool MediaStop : 1; // VK_MEDIA_STOP, 0xB2
|
||||
bool MediaPlayPause : 1; // VK_MEDIA_PLAY_PAUSE, 0xB3
|
||||
bool LaunchMail : 1; // VK_LAUNCH_MAIL, 0xB4
|
||||
bool SelectMedia : 1; // VK_LAUNCH_MEDIA_SELECT, 0xB5
|
||||
bool LaunchApplication1 : 1;// VK_LAUNCH_APP1, 0xB6
|
||||
bool LaunchApplication2 : 1;// VK_LAUNCH_APP2, 0xB7
|
||||
bool Reserved14 : 2;
|
||||
bool OemSemicolon : 1; // VK_OEM_1, 0xBA
|
||||
bool OemPlus : 1; // VK_OEM_PLUS, 0xBB
|
||||
bool OemComma : 1; // VK_OEM_COMMA, 0xBC
|
||||
bool OemMinus : 1; // VK_OEM_MINUS, 0xBD
|
||||
bool OemPeriod : 1; // VK_OEM_PERIOD, 0xBE
|
||||
bool OemQuestion : 1; // VK_OEM_2, 0xBF
|
||||
bool OemTilde : 1; // VK_OEM_3, 0xC0
|
||||
bool Reserved15 : 7;
|
||||
bool Reserved16 : 8;
|
||||
bool Reserved17 : 8;
|
||||
bool Reserved18 : 3;
|
||||
bool OemOpenBrackets : 1; // VK_OEM_4, 0xDB
|
||||
bool OemPipe : 1; // VK_OEM_5, 0xDC
|
||||
bool OemCloseBrackets : 1; // VK_OEM_6, 0xDD
|
||||
bool OemQuotes : 1; // VK_OEM_7, 0xDE
|
||||
bool Oem8 : 1; // VK_OEM_8, 0xDF
|
||||
bool Reserved19 : 2;
|
||||
bool OemBackslash : 1; // VK_OEM_102, 0xE2
|
||||
bool Reserved20 : 2;
|
||||
bool ProcessKey : 1; // VK_PROCESSKEY, 0xE5
|
||||
bool Reserved21 : 2;
|
||||
bool Reserved22 : 8;
|
||||
bool Reserved23 : 2;
|
||||
bool OemCopy : 1; // 0XF2
|
||||
bool OemAuto : 1; // 0xF3
|
||||
bool OemEnlW : 1; // 0xF4
|
||||
bool Reserved24 : 1;
|
||||
bool Attn : 1; // VK_ATTN, 0xF6
|
||||
bool Crsel : 1; // VK_CRSEL, 0xF7
|
||||
bool Exsel : 1; // VK_EXSEL, 0xF8
|
||||
bool EraseEof : 1; // VK_EREOF, 0xF9
|
||||
bool Play : 1; // VK_PLAY, 0xFA
|
||||
bool Zoom : 1; // VK_ZOOM, 0xFB
|
||||
bool Reserved25 : 1;
|
||||
bool Pa1 : 1; // VK_PA1, 0xFD
|
||||
bool OemClear : 1; // VK_OEM_CLEAR, 0xFE
|
||||
bool Reserved26: 1;
|
||||
|
||||
bool __cdecl IsKeyDown(Keys key) const
|
||||
{
|
||||
if (key >= 0 && key <= 0xff)
|
||||
{
|
||||
auto ptr = reinterpret_cast<const uint32_t*>(this);
|
||||
unsigned int bf = 1u << (key & 0x1f);
|
||||
return (ptr[(key >> 5)] & bf) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __cdecl IsKeyUp(Keys key) const
|
||||
{
|
||||
if (key >= 0 && key <= 0xfe)
|
||||
{
|
||||
auto ptr = reinterpret_cast<const uint32_t*>(this);
|
||||
unsigned int bf = 1u << (key & 0x1f);
|
||||
return (ptr[(key >> 5)] & bf) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class KeyboardStateTracker
|
||||
{
|
||||
public:
|
||||
State released;
|
||||
State pressed;
|
||||
|
||||
KeyboardStateTracker() { Reset(); }
|
||||
|
||||
void __cdecl Update(const State& state);
|
||||
|
||||
void __cdecl Reset();
|
||||
|
||||
bool __cdecl IsKeyPressed(Keys key) const { return pressed.IsKeyDown(key); }
|
||||
bool __cdecl IsKeyReleased(Keys key) const { return released.IsKeyDown(key); }
|
||||
|
||||
public:
|
||||
State lastState;
|
||||
};
|
||||
|
||||
// Retrieve the current state of the keyboard
|
||||
State __cdecl GetState() const;
|
||||
|
||||
// Reset the keyboard state
|
||||
void __cdecl Reset();
|
||||
|
||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) && defined(WM_USER)
|
||||
static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
|
||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||
void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window);
|
||||
#ifdef __cplusplus_winrt
|
||||
void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
|
||||
{
|
||||
// See https://msdn.microsoft.com/en-us/library/hh755802.aspx
|
||||
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Singleton
|
||||
static Keyboard& __cdecl Get();
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
class Impl;
|
||||
|
||||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
Keyboard(Keyboard const&) DIRECTX_CTOR_DELETE
|
||||
Keyboard& operator=(Keyboard const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
|
@ -34,11 +34,20 @@
|
|||
#include <intsafe.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
#include <wrl.h>
|
||||
#include <wrl\client.h>
|
||||
|
||||
// VS 2010 doesn't support explicit calling convention for std::function
|
||||
#ifndef DIRECTX_STD_CALLCONV
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
#define DIRECTX_STD_CALLCONV
|
||||
#else
|
||||
#define DIRECTX_STD_CALLCONV __cdecl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
#if (DIRECTXMATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#define XM_CALLCONV __fastcall
|
||||
typedef const XMVECTOR& HXMVECTOR;
|
||||
typedef const XMMATRIX& FXMMATRIX;
|
||||
|
@ -49,11 +58,13 @@ namespace DirectX
|
|||
class CommonStates;
|
||||
class ModelMesh;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Each mesh part is a submesh with a single effect
|
||||
class ModelMeshPart
|
||||
{
|
||||
public:
|
||||
ModelMeshPart();
|
||||
virtual ~ModelMeshPart();
|
||||
|
||||
uint32_t indexCount;
|
||||
uint32_t startIndex;
|
||||
|
@ -71,22 +82,24 @@ namespace DirectX
|
|||
typedef std::vector<std::unique_ptr<ModelMeshPart>> Collection;
|
||||
|
||||
// Draw mesh part with custom effect
|
||||
void Draw( _In_ ID3D11DeviceContext* deviceContext, _In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout,
|
||||
_In_opt_ std::function<void()> setCustomState = nullptr ) const;
|
||||
void __cdecl Draw( _In_ ID3D11DeviceContext* deviceContext, _In_ IEffect* ieffect, _In_ ID3D11InputLayout* iinputLayout,
|
||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr ) const;
|
||||
|
||||
// Create input layout for drawing with a custom effect.
|
||||
void CreateInputLayout( _In_ ID3D11Device* d3dDevice, _In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout );
|
||||
void __cdecl CreateInputLayout( _In_ ID3D11Device* d3dDevice, _In_ IEffect* ieffect, _Outptr_ ID3D11InputLayout** iinputLayout );
|
||||
|
||||
// Change effect used by part and regenerate input layout (be sure to call Model::Modified as well)
|
||||
void ModifyEffect( _In_ ID3D11Device* d3dDevice, _In_ std::shared_ptr<IEffect>& effect, bool isalpha = false );
|
||||
void __cdecl ModifyEffect( _In_ ID3D11Device* d3dDevice, _In_ std::shared_ptr<IEffect>& ieffect, bool isalpha = false );
|
||||
};
|
||||
|
||||
|
||||
// A mesh consists of one or more model parts
|
||||
//----------------------------------------------------------------------------------
|
||||
// A mesh consists of one or more model mesh parts
|
||||
class ModelMesh
|
||||
{
|
||||
public:
|
||||
ModelMesh();
|
||||
virtual ~ModelMesh();
|
||||
|
||||
BoundingSphere boundingSphere;
|
||||
BoundingBox boundingBox;
|
||||
|
@ -98,43 +111,52 @@ namespace DirectX
|
|||
typedef std::vector<std::shared_ptr<ModelMesh>> Collection;
|
||||
|
||||
// Setup states for drawing mesh
|
||||
void PrepareForRendering( _In_ ID3D11DeviceContext* deviceContext, CommonStates& states, bool alpha = false, bool wireframe = false ) const;
|
||||
void __cdecl PrepareForRendering( _In_ ID3D11DeviceContext* deviceContext, CommonStates& states, bool alpha = false, bool wireframe = false ) const;
|
||||
|
||||
// Draw the mesh
|
||||
void XM_CALLCONV Draw( _In_ ID3D11DeviceContext* deviceContext, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
|
||||
bool alpha = false, _In_opt_ std::function<void()> setCustomState = nullptr ) const;
|
||||
bool alpha = false, _In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr ) const;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// A model consists of one or more meshes
|
||||
class Model
|
||||
{
|
||||
public:
|
||||
virtual ~Model();
|
||||
|
||||
ModelMesh::Collection meshes;
|
||||
std::wstring name;
|
||||
|
||||
// Draw all the meshes in the model
|
||||
void XM_CALLCONV Draw( _In_ ID3D11DeviceContext* deviceContext, CommonStates& states, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
|
||||
bool wireframe = false, _In_opt_ std::function<void()> setCustomState = nullptr ) const;
|
||||
bool wireframe = false, _In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr ) const;
|
||||
|
||||
// Notify model that effects, parts list, or mesh list has changed
|
||||
void Modified() { mEffectCache.clear(); }
|
||||
void __cdecl Modified() { mEffectCache.clear(); }
|
||||
|
||||
// Update all effects used by the model
|
||||
void UpdateEffects( _In_ std::function<void(IEffect*)> setEffect );
|
||||
void __cdecl UpdateEffects( _In_ std::function<void DIRECTX_STD_CALLCONV(IEffect*)> setEffect );
|
||||
|
||||
// Loads a model from a Visual Studio Starter Kit .CMO file
|
||||
static std::unique_ptr<Model> CreateFromCMO( _In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, size_t dataSize,
|
||||
static std::unique_ptr<Model> __cdecl CreateFromCMO( _In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, size_t dataSize,
|
||||
_In_ IEffectFactory& fxFactory, bool ccw = true, bool pmalpha = false );
|
||||
static std::unique_ptr<Model> CreateFromCMO( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName,
|
||||
static std::unique_ptr<Model> __cdecl CreateFromCMO( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName,
|
||||
_In_ IEffectFactory& fxFactory, bool ccw = true, bool pmalpha = false );
|
||||
|
||||
// Loads a model from a DirectX SDK .SDKMESH file
|
||||
static std::unique_ptr<Model> CreateFromSDKMESH( _In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize,
|
||||
static std::unique_ptr<Model> __cdecl CreateFromSDKMESH( _In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize,
|
||||
_In_ IEffectFactory& fxFactory, bool ccw = false, bool pmalpha = false );
|
||||
static std::unique_ptr<Model> CreateFromSDKMESH( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName,
|
||||
static std::unique_ptr<Model> __cdecl CreateFromSDKMESH( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName,
|
||||
_In_ IEffectFactory& fxFactory, bool ccw = false, bool pmalpha = false );
|
||||
|
||||
// Loads a model from a .VBO file
|
||||
static std::unique_ptr<Model> __cdecl CreateFromVBO( _In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize,
|
||||
_In_opt_ std::shared_ptr<IEffect> ieffect = nullptr, bool ccw = false, bool pmalpha = false );
|
||||
static std::unique_ptr<Model> __cdecl CreateFromVBO( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName,
|
||||
_In_opt_ std::shared_ptr<IEffect> ieffect = nullptr, bool ccw = false, bool pmalpha = false );
|
||||
|
||||
private:
|
||||
std::set<IEffect*> mEffectCache;
|
||||
};
|
||||
|
|
129
Windows/DirectXTK/Mouse.h
Normal file
129
Windows/DirectXTK/Mouse.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// File: Mouse.h
|
||||
//
|
||||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||
// PARTICULAR PURPOSE.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||
namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } }
|
||||
#endif
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
class Mouse
|
||||
{
|
||||
public:
|
||||
Mouse();
|
||||
Mouse(Mouse&& moveFrom);
|
||||
Mouse& operator= (Mouse&& moveFrom);
|
||||
virtual ~Mouse();
|
||||
|
||||
enum Mode
|
||||
{
|
||||
MODE_ABSOLUTE = 0,
|
||||
MODE_RELATIVE,
|
||||
};
|
||||
|
||||
struct State
|
||||
{
|
||||
bool leftButton;
|
||||
bool middleButton;
|
||||
bool rightButton;
|
||||
bool xButton1;
|
||||
bool xButton2;
|
||||
int x;
|
||||
int y;
|
||||
int scrollWheelValue;
|
||||
Mode positionMode;
|
||||
};
|
||||
|
||||
class ButtonStateTracker
|
||||
{
|
||||
public:
|
||||
enum ButtonState
|
||||
{
|
||||
UP = 0, // Button is up
|
||||
HELD = 1, // Button is held down
|
||||
RELEASED = 2, // Button was just released
|
||||
PRESSED = 3, // Buton was just pressed
|
||||
};
|
||||
|
||||
ButtonState leftButton;
|
||||
ButtonState middleButton;
|
||||
ButtonState rightButton;
|
||||
ButtonState xButton1;
|
||||
ButtonState xButton2;
|
||||
|
||||
ButtonStateTracker() { Reset(); }
|
||||
|
||||
void __cdecl Update( const State& state );
|
||||
|
||||
void __cdecl Reset();
|
||||
|
||||
private:
|
||||
State lastState;
|
||||
};
|
||||
|
||||
// Retrieve the current state of the mouse
|
||||
State __cdecl GetState() const;
|
||||
|
||||
// Resets the accumulated scroll wheel value
|
||||
void __cdecl ResetScrollWheelValue();
|
||||
|
||||
// Sets mouse mode (defaults to absolute)
|
||||
void __cdecl SetMode(Mode mode);
|
||||
|
||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) && defined(WM_USER)
|
||||
void __cdecl SetWindow(HWND window);
|
||||
static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
|
||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||
void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window);
|
||||
#ifdef __cplusplus_winrt
|
||||
void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
|
||||
{
|
||||
// See https://msdn.microsoft.com/en-us/library/hh755802.aspx
|
||||
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
|
||||
}
|
||||
#endif
|
||||
static void __cdecl SetDpi(float dpi);
|
||||
#endif
|
||||
|
||||
// Singleton
|
||||
static Mouse& __cdecl Get();
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
class Impl;
|
||||
|
||||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
Mouse(Mouse const&) DIRECTX_CTOR_DELETE
|
||||
Mouse& operator=(Mouse const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
|
@ -13,12 +13,23 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <memory.h>
|
||||
#include <memory>
|
||||
|
||||
|
@ -43,12 +54,12 @@ namespace DirectX
|
|||
|
||||
public:
|
||||
// Begin/End a batch of primitive drawing operations.
|
||||
void Begin();
|
||||
void End();
|
||||
void __cdecl Begin();
|
||||
void __cdecl End();
|
||||
|
||||
protected:
|
||||
// Internal, untyped drawing method.
|
||||
void Draw(D3D11_PRIMITIVE_TOPOLOGY topology, bool isIndexed, _In_opt_count_(indexCount) uint16_t const* indices, size_t indexCount, size_t vertexCount, _Out_ void** pMappedVertices);
|
||||
void __cdecl Draw(D3D11_PRIMITIVE_TOPOLOGY topology, bool isIndexed, _In_opt_count_(indexCount) uint16_t const* indices, size_t indexCount, size_t vertexCount, _Out_ void** pMappedVertices);
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -57,8 +68,8 @@ namespace DirectX
|
|||
std::unique_ptr<Impl> pImpl;
|
||||
|
||||
// Prevent copying.
|
||||
PrimitiveBatchBase(PrimitiveBatchBase const&);
|
||||
PrimitiveBatchBase& operator= (PrimitiveBatchBase const&);
|
||||
PrimitiveBatchBase(PrimitiveBatchBase const&) DIRECTX_CTOR_DELETE
|
||||
PrimitiveBatchBase& operator= (PrimitiveBatchBase const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -78,7 +89,7 @@ namespace DirectX
|
|||
: PrimitiveBatchBase(std::move(moveFrom))
|
||||
{ }
|
||||
|
||||
PrimitiveBatch& operator= (PrimitiveBatch&& moveFrom)
|
||||
PrimitiveBatch& __cdecl operator= (PrimitiveBatch&& moveFrom)
|
||||
{
|
||||
PrimitiveBatchBase::operator=(std::move(moveFrom));
|
||||
return *this;
|
||||
|
@ -86,7 +97,7 @@ namespace DirectX
|
|||
|
||||
|
||||
// Similar to the D3D9 API DrawPrimitiveUP.
|
||||
void Draw(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount)
|
||||
void __cdecl Draw(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount)
|
||||
{
|
||||
void* mappedVertices;
|
||||
|
||||
|
@ -97,7 +108,7 @@ namespace DirectX
|
|||
|
||||
|
||||
// Similar to the D3D9 API DrawIndexedPrimitiveUP.
|
||||
void DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount)
|
||||
void __cdecl DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount)
|
||||
{
|
||||
void* mappedVertices;
|
||||
|
||||
|
@ -107,7 +118,7 @@ namespace DirectX
|
|||
}
|
||||
|
||||
|
||||
void DrawLine(TVertex const& v1, TVertex const& v2)
|
||||
void __cdecl DrawLine(TVertex const& v1, TVertex const& v2)
|
||||
{
|
||||
TVertex* mappedVertices;
|
||||
|
||||
|
@ -118,7 +129,7 @@ namespace DirectX
|
|||
}
|
||||
|
||||
|
||||
void DrawTriangle(TVertex const& v1, TVertex const& v2, TVertex const& v3)
|
||||
void __cdecl DrawTriangle(TVertex const& v1, TVertex const& v2, TVertex const& v3)
|
||||
{
|
||||
TVertex* mappedVertices;
|
||||
|
||||
|
@ -130,7 +141,7 @@ namespace DirectX
|
|||
}
|
||||
|
||||
|
||||
void DrawQuad(TVertex const& v1, TVertex const& v2, TVertex const& v3, TVertex const& v4)
|
||||
void __cdecl DrawQuad(TVertex const& v1, TVertex const& v2, TVertex const& v3, TVertex const& v4)
|
||||
{
|
||||
static const uint16_t quadIndices[] = { 0, 1, 2, 0, 2, 3 };
|
||||
|
||||
|
|
|
@ -19,11 +19,9 @@
|
|||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
|
@ -38,20 +36,29 @@
|
|||
|
||||
#include <functional>
|
||||
|
||||
// VS 2010 doesn't support explicit calling convention for std::function
|
||||
#ifndef DIRECTX_STD_CALLCONV
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
#define DIRECTX_STD_CALLCONV
|
||||
#else
|
||||
#define DIRECTX_STD_CALLCONV __cdecl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
HRESULT __cdecl SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
_In_ ID3D11Resource* pSource,
|
||||
_In_z_ LPCWSTR fileName );
|
||||
|
||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8)
|
||||
|
||||
HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
HRESULT __cdecl SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
_In_ ID3D11Resource* pSource,
|
||||
_In_ REFGUID guidContainerFormat,
|
||||
_In_z_ LPCWSTR fileName,
|
||||
_In_opt_ const GUID* targetFormat = nullptr,
|
||||
_In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
|
||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV(IPropertyBag2*)> setCustomProps = nullptr );
|
||||
|
||||
#endif
|
||||
}
|
|
@ -11,16 +11,20 @@
|
|||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <memory.h>
|
||||
|
||||
#include "DirectXMath.h"
|
||||
#include "DirectXPackedVector.h"
|
||||
#include "DirectXCollision.h"
|
||||
#include <DirectXMath.h>
|
||||
#include <DirectXPackedVector.h>
|
||||
#include <DirectXCollision.h>
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
|
@ -42,22 +46,24 @@ struct Vector2 : public XMFLOAT2
|
|||
Vector2(float _x, float _y) : XMFLOAT2(_x, _y) {}
|
||||
explicit Vector2(_In_reads_(2) const float *pArray) : XMFLOAT2(pArray) {}
|
||||
Vector2(FXMVECTOR V) { XMStoreFloat2( this, V ); }
|
||||
Vector2(const XMFLOAT2& V) { this->x = V.x; this->y = V.y; }
|
||||
|
||||
operator XMVECTOR() const { return XMLoadFloat2( this ); }
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Vector2& V ) const;
|
||||
bool operator != ( const Vector2& V ) const;
|
||||
|
||||
// Assignment operators
|
||||
Vector2& operator= (const Vector2& V) { x = V.x; y = V.y; return *this; }
|
||||
Vector2& operator= (const XMFLOAT2& V) { x = V.x; y = V.y; return *this; }
|
||||
Vector2& operator+= (const Vector2& V);
|
||||
Vector2& operator-= (const Vector2& V);
|
||||
Vector2& operator*= (const Vector2& V);
|
||||
Vector2& operator*= (float S);
|
||||
Vector2& operator/= (float S);
|
||||
|
||||
// Urnary operators
|
||||
// Unary operators
|
||||
Vector2 operator+ () const { return *this; }
|
||||
Vector2 operator- () const { return Vector2(-x, -y); }
|
||||
|
||||
|
@ -121,6 +127,12 @@ struct Vector2 : public XMFLOAT2
|
|||
static void TransformNormal( const Vector2& v, const Matrix& m, Vector2& result );
|
||||
static Vector2 TransformNormal( const Vector2& v, const Matrix& m );
|
||||
static void TransformNormal( _In_reads_(count) const Vector2* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector2* resultArray );
|
||||
|
||||
// Constants
|
||||
static const Vector2 Zero;
|
||||
static const Vector2 One;
|
||||
static const Vector2 UnitX;
|
||||
static const Vector2 UnitY;
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
|
@ -140,22 +152,24 @@ struct Vector3 : public XMFLOAT3
|
|||
Vector3(float _x, float _y, float _z) : XMFLOAT3(_x, _y, _z) {}
|
||||
explicit Vector3(_In_reads_(3) const float *pArray) : XMFLOAT3(pArray) {}
|
||||
Vector3(FXMVECTOR V) { XMStoreFloat3( this, V ); }
|
||||
Vector3(const XMFLOAT3& V) { this->x = V.x; this->y = V.y; this->z = V.z; }
|
||||
|
||||
operator XMVECTOR() const { return XMLoadFloat3( this ); }
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Vector3& V ) const;
|
||||
bool operator != ( const Vector3& V ) const;
|
||||
|
||||
// Assignment operators
|
||||
Vector3& operator= (const Vector3& V) { x = V.x; y = V.y; z = V.z; return *this; }
|
||||
Vector3& operator= (const XMFLOAT3& V) { x = V.x; y = V.y; z = V.z; return *this; }
|
||||
Vector3& operator+= (const Vector3& V);
|
||||
Vector3& operator-= (const Vector3& V);
|
||||
Vector3& operator*= (const Vector3& V);
|
||||
Vector3& operator*= (float S);
|
||||
Vector3& operator/= (float S);
|
||||
|
||||
// Urnary operators
|
||||
// Unary operators
|
||||
Vector3 operator+ () const { return *this; }
|
||||
Vector3 operator- () const;
|
||||
|
||||
|
@ -219,6 +233,19 @@ struct Vector3 : public XMFLOAT3
|
|||
static void TransformNormal( const Vector3& v, const Matrix& m, Vector3& result );
|
||||
static Vector3 TransformNormal( const Vector3& v, const Matrix& m );
|
||||
static void TransformNormal( _In_reads_(count) const Vector3* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector3* resultArray );
|
||||
|
||||
// Constants
|
||||
static const Vector3 Zero;
|
||||
static const Vector3 One;
|
||||
static const Vector3 UnitX;
|
||||
static const Vector3 UnitY;
|
||||
static const Vector3 UnitZ;
|
||||
static const Vector3 Up;
|
||||
static const Vector3 Down;
|
||||
static const Vector3 Right;
|
||||
static const Vector3 Left;
|
||||
static const Vector3 Forward;
|
||||
static const Vector3 Backward;
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
|
@ -238,22 +265,24 @@ struct Vector4 : public XMFLOAT4
|
|||
Vector4(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {}
|
||||
explicit Vector4(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {}
|
||||
Vector4(FXMVECTOR V) { XMStoreFloat4( this, V ); }
|
||||
Vector4(const XMFLOAT4& V) { this->x = V.x; this->y = V.y; this->z = V.z; this->w = V.w; }
|
||||
|
||||
operator XMVECTOR() const { return XMLoadFloat4( this ); }
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Vector4& V ) const;
|
||||
bool operator != ( const Vector4& V ) const;
|
||||
|
||||
// Assignment operators
|
||||
Vector4& operator= (const Vector4& V) { x = V.x; y = V.y; z = V.z; w = V.w; return *this; }
|
||||
Vector4& operator= (const XMFLOAT4& V) { x = V.x; y = V.y; z = V.z; w = V.w; return *this; }
|
||||
Vector4& operator+= (const Vector4& V);
|
||||
Vector4& operator-= (const Vector4& V);
|
||||
Vector4& operator*= (const Vector4& V);
|
||||
Vector4& operator*= (float S);
|
||||
Vector4& operator/= (float S);
|
||||
|
||||
// Urnary operators
|
||||
// Unary operators
|
||||
Vector4 operator+ () const { return *this; }
|
||||
Vector4 operator- () const;
|
||||
|
||||
|
@ -316,6 +345,14 @@ struct Vector4 : public XMFLOAT4
|
|||
static void Transform( const Vector4& v, const Matrix& m, Vector4& result );
|
||||
static Vector4 Transform( const Vector4& v, const Matrix& m );
|
||||
static void Transform( _In_reads_(count) const Vector4* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector4* resultArray );
|
||||
|
||||
// Constants
|
||||
static const Vector4 Zero;
|
||||
static const Vector4 One;
|
||||
static const Vector4 UnitX;
|
||||
static const Vector4 UnitY;
|
||||
static const Vector4 UnitZ;
|
||||
static const Vector4 UnitW;
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
|
@ -349,17 +386,24 @@ struct Matrix : public XMFLOAT4X4
|
|||
r1.x, r1.y, r1.z, r1.w,
|
||||
r2.x, r2.y, r2.z, r2.w,
|
||||
r3.x, r3.y, r3.z, r3.w ) {}
|
||||
Matrix(const XMFLOAT4X4& M) { memcpy_s(this, sizeof(float)*16, &M, sizeof(XMFLOAT4X4)); }
|
||||
Matrix(const XMFLOAT3X3& M);
|
||||
Matrix(const XMFLOAT4X3& M);
|
||||
|
||||
explicit Matrix(_In_reads_(16) const float *pArray) : XMFLOAT4X4(pArray) {}
|
||||
Matrix( CXMMATRIX M ) { XMStoreFloat4x4( this, M ); }
|
||||
|
||||
operator XMMATRIX() const { return XMLoadFloat4x4( this ); }
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Matrix& M ) const;
|
||||
bool operator != ( const Matrix& M ) const;
|
||||
|
||||
// Assignment operators
|
||||
Matrix& operator= (const Matrix& M) { memcpy_s( this, sizeof(float)*16, &M, sizeof(float)*16 ); return *this; }
|
||||
Matrix& operator= (const XMFLOAT4X4& M) { memcpy_s( this, sizeof(float)*16, &M, sizeof(XMFLOAT4X4) ); return *this; }
|
||||
Matrix& operator= (const XMFLOAT3X3& M);
|
||||
Matrix& operator= (const XMFLOAT4X3& M);
|
||||
Matrix& operator+= (const Matrix& M);
|
||||
Matrix& operator-= (const Matrix& M);
|
||||
Matrix& operator*= (const Matrix& M);
|
||||
|
@ -369,7 +413,7 @@ struct Matrix : public XMFLOAT4X4
|
|||
Matrix& operator/= (const Matrix& M);
|
||||
// Element-wise divide
|
||||
|
||||
// Urnary operators
|
||||
// Unary operators
|
||||
Matrix operator+ () const { return *this; }
|
||||
Matrix operator- () const;
|
||||
|
||||
|
@ -407,7 +451,10 @@ struct Matrix : public XMFLOAT4X4
|
|||
float Determinant() const;
|
||||
|
||||
// Static functions
|
||||
static Matrix Identity();
|
||||
static Matrix CreateBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& cameraUp, _In_opt_ const Vector3* cameraForward = nullptr );
|
||||
|
||||
static Matrix CreateConstrainedBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& rotateAxis,
|
||||
_In_opt_ const Vector3* cameraForward = nullptr, _In_opt_ const Vector3* objectForward = nullptr);
|
||||
|
||||
static Matrix CreateTranslation( const Vector3& position );
|
||||
static Matrix CreateTranslation( float x, float y, float z );
|
||||
|
@ -444,6 +491,9 @@ struct Matrix : public XMFLOAT4X4
|
|||
|
||||
static void Transform( const Matrix& M, const Quaternion& rotation, Matrix& result );
|
||||
static Matrix Transform( const Matrix& M, const Quaternion& rotation );
|
||||
|
||||
// Constants
|
||||
static const Matrix Identity;
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
|
@ -469,15 +519,17 @@ struct Plane : public XMFLOAT4
|
|||
explicit Plane(const Vector4& v) : XMFLOAT4(v.x, v.y, v.z, v.w) {}
|
||||
explicit Plane(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {}
|
||||
Plane(FXMVECTOR V) { XMStoreFloat4( this, V ); }
|
||||
Plane(const XMFLOAT4& p) { this->x = p.x; this->y = p.y; this->z = p.z; this->w = p.w; }
|
||||
|
||||
operator XMVECTOR() const { return XMLoadFloat4( this ); }
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Plane& p ) const;
|
||||
bool operator != ( const Plane& p ) const;
|
||||
|
||||
// Assignment operators
|
||||
Plane& operator= (const Plane& p) { x = p.x; y = p.y; z = p.z; w = p.w; return *this; }
|
||||
Plane& operator= (const XMFLOAT4& p) { x = p.x; y = p.y; z = p.z; w = p.w; return *this; }
|
||||
|
||||
// Properties
|
||||
Vector3 Normal() const { return Vector3( x, y, z ); }
|
||||
|
@ -513,22 +565,24 @@ struct Quaternion : public XMFLOAT4
|
|||
explicit Quaternion( const Vector4& v ) : XMFLOAT4( v.x, v.y, v.z, v.w ) {}
|
||||
explicit Quaternion(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {}
|
||||
Quaternion(FXMVECTOR V) { XMStoreFloat4( this, V ); }
|
||||
Quaternion(const XMFLOAT4& q) { this->x = q.x; this->y = q.y; this->z = q.z; this->w = q.w; }
|
||||
|
||||
operator XMVECTOR() const { return XMLoadFloat4( this ); }
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Quaternion& q ) const;
|
||||
bool operator != ( const Quaternion& q ) const;
|
||||
|
||||
// Assignment operators
|
||||
Quaternion& operator= (const Quaternion& q) { x = q.x; y = q.y; z = q.z; w = q.w; return *this; }
|
||||
Quaternion& operator= (const XMFLOAT4& q) { x = q.x; y = q.y; z = q.z; w = q.w; return *this; }
|
||||
Quaternion& operator+= (const Quaternion& q);
|
||||
Quaternion& operator-= (const Quaternion& q);
|
||||
Quaternion& operator*= (const Quaternion& q);
|
||||
Quaternion& operator*= (float S);
|
||||
Quaternion& operator/= (const Quaternion& q);
|
||||
|
||||
// Urnary operators
|
||||
// Unary operators
|
||||
Quaternion operator+ () const { return *this; }
|
||||
Quaternion operator- () const;
|
||||
|
||||
|
@ -559,6 +613,9 @@ struct Quaternion : public XMFLOAT4
|
|||
|
||||
static void Concatenate( const Quaternion& q1, const Quaternion& q2, Quaternion& result );
|
||||
static Quaternion Concatenate( const Quaternion& q1, const Quaternion& q2 );
|
||||
|
||||
// Constants
|
||||
static const Quaternion Identity;
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
|
@ -580,6 +637,7 @@ struct Color : public XMFLOAT4
|
|||
explicit Color( const Vector4& clr ) : XMFLOAT4( clr.x, clr.y, clr.z, clr.w ) {}
|
||||
explicit Color(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {}
|
||||
Color(FXMVECTOR V) { XMStoreFloat4( this, V ); }
|
||||
Color(const XMFLOAT4& c) { this->x = c.x; this->y = c.y; this->z = c.z; this->w = c.w; }
|
||||
|
||||
explicit Color( const DirectX::PackedVector::XMCOLOR& Packed );
|
||||
// BGRA Direct3D 9 D3DCOLOR packed color
|
||||
|
@ -590,19 +648,22 @@ struct Color : public XMFLOAT4
|
|||
operator XMVECTOR() const { return XMLoadFloat4( this ); }
|
||||
operator const float*() const { return reinterpret_cast<const float*>(this); }
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Color& c ) const;
|
||||
bool operator != ( const Color& c ) const;
|
||||
|
||||
// Assignment operators
|
||||
Color& operator= (const Color& c) { x = c.x; y = c.y; z = c.z; w = c.w; return *this; }
|
||||
Color& operator= (const XMFLOAT4& c) { x = c.x; y = c.y; z = c.z; w = c.w; return *this; }
|
||||
Color& operator= (const DirectX::PackedVector::XMCOLOR& Packed);
|
||||
Color& operator= (const DirectX::PackedVector::XMUBYTEN4& Packed);
|
||||
Color& operator+= (const Color& c);
|
||||
Color& operator-= (const Color& c);
|
||||
Color& operator*= (const Color& c);
|
||||
Color& operator*= (float S);
|
||||
Color& operator/= (const Color& c);
|
||||
|
||||
// Urnary operators
|
||||
// Unary operators
|
||||
Color operator+ () const { return *this; }
|
||||
Color operator- () const;
|
||||
|
||||
|
@ -668,7 +729,7 @@ public:
|
|||
Ray() : position(0,0,0), direction(0,0,1) {}
|
||||
Ray( const Vector3& pos, const Vector3& dir ) : position(pos), direction(dir) {}
|
||||
|
||||
// Comparision operators
|
||||
// Comparison operators
|
||||
bool operator == ( const Ray& r ) const;
|
||||
bool operator != ( const Ray& r ) const;
|
||||
|
||||
|
@ -679,6 +740,59 @@ public:
|
|||
bool Intersects( const Plane& plane, _Out_ float& Dist ) const;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Viewport
|
||||
class Viewport
|
||||
{
|
||||
public:
|
||||
float x;
|
||||
float y;
|
||||
float width;
|
||||
float height;
|
||||
float minDepth;
|
||||
float maxDepth;
|
||||
|
||||
Viewport() :
|
||||
x(0.f), y(0.f), width(0.f), height(0.f), minDepth(0.f), maxDepth(1.f) {}
|
||||
Viewport( float ix, float iy, float iw, float ih, float iminz = 0.f, float imaxz = 1.f ) :
|
||||
x(ix), y(iy), width(iw), height(ih), minDepth(iminz), maxDepth(imaxz) {}
|
||||
explicit Viewport(const RECT& rct) :
|
||||
x(float(rct.left)), y(float(rct.top)),
|
||||
width(float(rct.right - rct.left)),
|
||||
height(float(rct.bottom - rct.top)),
|
||||
minDepth(0.f), maxDepth(1.f) {}
|
||||
explicit Viewport(const D3D11_VIEWPORT& vp) :
|
||||
x(vp.TopLeftX), y(vp.TopLeftY),
|
||||
width(vp.Width), height(vp.Height),
|
||||
minDepth(vp.MinDepth), maxDepth(vp.MaxDepth) {}
|
||||
|
||||
// Direct3D 11 interop
|
||||
operator D3D11_VIEWPORT() { return *reinterpret_cast<D3D11_VIEWPORT*>(this); }
|
||||
const D3D11_VIEWPORT* Get11() const { return reinterpret_cast<const D3D11_VIEWPORT*>(this); }
|
||||
|
||||
// Comparison operators
|
||||
bool operator == ( const Viewport& vp ) const;
|
||||
bool operator != ( const Viewport& vp ) const;
|
||||
|
||||
// Assignment operators
|
||||
Viewport& operator= (const Viewport& vp);
|
||||
Viewport& operator= (const RECT& rct);
|
||||
Viewport& operator= (const D3D11_VIEWPORT& vp);
|
||||
|
||||
// Viewport operations
|
||||
float AspectRatio() const;
|
||||
|
||||
Vector3 Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world ) const;
|
||||
void Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result ) const;
|
||||
|
||||
Vector3 Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world ) const;
|
||||
void Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result ) const;
|
||||
|
||||
// Static methods
|
||||
static RECT __cdecl ComputeDisplayArea(DXGI_SCALING scaling, UINT backBufferWidth, UINT backBufferHeight, int outputWidth, int outputHeight);
|
||||
static RECT __cdecl ComputeTitleSafeArea(UINT backBufferWidth, UINT backBufferHeight);
|
||||
};
|
||||
|
||||
#include "SimpleMath.inl"
|
||||
|
||||
}; // namespace SimpleMath
|
||||
|
@ -793,4 +907,21 @@ namespace std
|
|||
}
|
||||
};
|
||||
|
||||
template<> struct less<DirectX::SimpleMath::Viewport>
|
||||
{
|
||||
bool operator()(const DirectX::SimpleMath::Viewport& vp1, const DirectX::SimpleMath::Viewport& vp2) const
|
||||
{
|
||||
if (vp1.x != vp2.x) return (vp1.x < vp2.x);
|
||||
if (vp1.y != vp2.y) return (vp1.y < vp2.y);
|
||||
|
||||
if (vp1.width != vp2.width) return (vp1.width < vp2.width);
|
||||
if (vp1.height != vp2.height) return (vp1.height < vp2.height);
|
||||
|
||||
if (vp1.minDepth != vp2.minDepth) return (vp1.minDepth < vp2.minDepth);
|
||||
if (vp1.maxDepth != vp2.maxDepth) return (vp1.maxDepth < vp2.maxDepth);
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
|
@ -1785,15 +1783,49 @@ inline bool Matrix::operator != ( const Matrix& M ) const
|
|||
XMVECTOR y4 = XMLoadFloat4( reinterpret_cast<const XMFLOAT4*>(&M._41) );
|
||||
|
||||
return ( XMVector4NotEqual( x1, y1 )
|
||||
&& XMVector4NotEqual( x2, y2 )
|
||||
&& XMVector4NotEqual( x3, y3 )
|
||||
&& XMVector4NotEqual( x4, y4 ) ) != 0;
|
||||
|| XMVector4NotEqual( x2, y2 )
|
||||
|| XMVector4NotEqual( x3, y3 )
|
||||
|| XMVector4NotEqual( x4, y4 ) ) != 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Assignment operators
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline Matrix::Matrix(const XMFLOAT3X3& M)
|
||||
{
|
||||
_11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f;
|
||||
_21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f;
|
||||
_31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f;
|
||||
_41 = 0.f; _42 = 0.f; _43 = 0.f; _44 = 1.f;
|
||||
}
|
||||
|
||||
inline Matrix::Matrix(const XMFLOAT4X3& M)
|
||||
{
|
||||
_11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f;
|
||||
_21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f;
|
||||
_31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f;
|
||||
_41 = M._41; _42 = M._42; _43 = M._43; _44 = 1.f;
|
||||
}
|
||||
|
||||
inline Matrix& Matrix::operator= (const XMFLOAT3X3& M)
|
||||
{
|
||||
_11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f;
|
||||
_21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f;
|
||||
_31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f;
|
||||
_41 = 0.f; _42 = 0.f; _43 = 0.f; _44 = 1.f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Matrix& Matrix::operator= (const XMFLOAT4X3& M)
|
||||
{
|
||||
_11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f;
|
||||
_21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f;
|
||||
_31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f;
|
||||
_41 = M._41; _42 = M._42; _43 = M._43; _44 = 1.f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Matrix& Matrix::operator+= (const Matrix& M)
|
||||
{
|
||||
using namespace DirectX;
|
||||
|
@ -2174,13 +2206,121 @@ inline float Matrix::Determinant() const
|
|||
// Static functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline Matrix Matrix::Identity()
|
||||
_Use_decl_annotations_
|
||||
inline Matrix Matrix::CreateBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& cameraUp, const Vector3* cameraForward )
|
||||
{
|
||||
using namespace DirectX;
|
||||
return Matrix( 1.f, 0, 0, 0,
|
||||
0, 1.f, 0, 0,
|
||||
0, 0, 1.f, 0,
|
||||
0, 0, 0, 1.f );
|
||||
XMVECTOR O = XMLoadFloat3( &object );
|
||||
XMVECTOR C = XMLoadFloat3( &cameraPosition );
|
||||
XMVECTOR Z = XMVectorSubtract( O, C );
|
||||
|
||||
XMVECTOR N = XMVector3LengthSq( Z );
|
||||
if ( XMVector3Less( N, g_XMEpsilon ) )
|
||||
{
|
||||
if ( cameraForward )
|
||||
{
|
||||
XMVECTOR F = XMLoadFloat3( cameraForward );
|
||||
Z = XMVectorNegate( F );
|
||||
}
|
||||
else
|
||||
Z = g_XMNegIdentityR2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Z = XMVector3Normalize( Z );
|
||||
}
|
||||
|
||||
XMVECTOR up = XMLoadFloat3( &cameraUp );
|
||||
XMVECTOR X = XMVector3Cross( up, Z );
|
||||
X = XMVector3Normalize( X );
|
||||
|
||||
XMVECTOR Y = XMVector3Cross( Z, X );
|
||||
|
||||
XMMATRIX M;
|
||||
M.r[0] = X;
|
||||
M.r[1] = Y;
|
||||
M.r[2] = Z;
|
||||
M.r[3] = XMVectorSetW( O, 1.f );
|
||||
|
||||
Matrix R;
|
||||
XMStoreFloat4x4( &R, M );
|
||||
return R;
|
||||
}
|
||||
|
||||
_Use_decl_annotations_
|
||||
inline Matrix Matrix::CreateConstrainedBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& rotateAxis,
|
||||
const Vector3* cameraForward, const Vector3* objectForward )
|
||||
{
|
||||
using namespace DirectX;
|
||||
|
||||
static const XMVECTORF32 s_minAngle = { 0.99825467075f, 0.99825467075f, 0.99825467075f, 0.99825467075f }; // 1.0 - XMConvertToRadians( 0.1f );
|
||||
|
||||
XMVECTOR O = XMLoadFloat3( &object );
|
||||
XMVECTOR C = XMLoadFloat3( &cameraPosition );
|
||||
XMVECTOR faceDir = XMVectorSubtract( O, C );
|
||||
|
||||
XMVECTOR N = XMVector3LengthSq( faceDir );
|
||||
if (XMVector3Less(N, g_XMEpsilon))
|
||||
{
|
||||
if (cameraForward)
|
||||
{
|
||||
XMVECTOR F = XMLoadFloat3( cameraForward );
|
||||
faceDir = XMVectorNegate( F );
|
||||
}
|
||||
else
|
||||
faceDir = g_XMNegIdentityR2;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceDir = XMVector3Normalize( faceDir );
|
||||
}
|
||||
|
||||
XMVECTOR Y = XMLoadFloat3( &rotateAxis );
|
||||
XMVECTOR X, Z;
|
||||
|
||||
XMVECTOR dot = XMVectorAbs( XMVector3Dot( Y, faceDir ) );
|
||||
if ( XMVector3Greater( dot, s_minAngle ) )
|
||||
{
|
||||
if ( objectForward )
|
||||
{
|
||||
Z = XMLoadFloat3( objectForward );
|
||||
dot = XMVectorAbs( XMVector3Dot( Y, Z ) );
|
||||
if ( XMVector3Greater( dot, s_minAngle ) )
|
||||
{
|
||||
dot = XMVectorAbs( XMVector3Dot( Y, g_XMNegIdentityR2 ) );
|
||||
Z = ( XMVector3Greater( dot, s_minAngle ) ) ? g_XMIdentityR0 : g_XMNegIdentityR2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dot = XMVectorAbs( XMVector3Dot( Y, g_XMNegIdentityR2 ) );
|
||||
Z = ( XMVector3Greater( dot, s_minAngle ) ) ? g_XMIdentityR0 : g_XMNegIdentityR2;
|
||||
}
|
||||
|
||||
X = XMVector3Cross( Y, Z );
|
||||
X = XMVector3Normalize( X );
|
||||
|
||||
Z = XMVector3Cross( X, Y );
|
||||
Z = XMVector3Normalize( Z );
|
||||
}
|
||||
else
|
||||
{
|
||||
X = XMVector3Cross( Y, faceDir );
|
||||
X = XMVector3Normalize( X );
|
||||
|
||||
Z = XMVector3Cross( X, Y );
|
||||
Z = XMVector3Normalize( Z );
|
||||
}
|
||||
|
||||
XMMATRIX M;
|
||||
M.r[0] = X;
|
||||
M.r[1] = Y;
|
||||
M.r[2] = Z;
|
||||
M.r[3] = XMVectorSetW( O, 1.f );
|
||||
|
||||
Matrix R;
|
||||
XMStoreFloat4x4( &R, M );
|
||||
return R;
|
||||
}
|
||||
|
||||
inline Matrix Matrix::CreateTranslation( const Vector3& position )
|
||||
|
@ -2951,6 +3091,20 @@ inline bool Color::operator != ( const Color& c ) const
|
|||
// Assignment operators
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline Color& Color::operator= (const DirectX::PackedVector::XMCOLOR& Packed)
|
||||
{
|
||||
using namespace DirectX;
|
||||
XMStoreFloat4( this, PackedVector::XMLoadColor( &Packed ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Color& Color::operator= (const DirectX::PackedVector::XMUBYTEN4& Packed)
|
||||
{
|
||||
using namespace DirectX;
|
||||
XMStoreFloat4( this, PackedVector::XMLoadUByteN4( &Packed ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Color& Color::operator+= (const Color& c)
|
||||
{
|
||||
using namespace DirectX;
|
||||
|
@ -3301,3 +3455,109 @@ inline bool Ray::Intersects( const Plane& plane, _Out_ float& Dist ) const
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Viewport
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Comparision operators
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline bool Viewport::operator == ( const Viewport& vp ) const
|
||||
{
|
||||
return (x == vp.x && y == vp.y
|
||||
&& width == vp.width && height == vp.height
|
||||
&& minDepth == vp.minDepth && maxDepth == vp.maxDepth);
|
||||
}
|
||||
|
||||
inline bool Viewport::operator != ( const Viewport& vp ) const
|
||||
{
|
||||
return (x != vp.x || y != vp.y
|
||||
|| width != vp.width || height != vp.height
|
||||
|| minDepth != vp.minDepth || maxDepth != vp.maxDepth);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Assignment operators
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline Viewport& Viewport::operator= (const Viewport& vp)
|
||||
{
|
||||
x = vp.x; y = vp.y;
|
||||
width = vp.width; height = vp.height;
|
||||
minDepth = vp.minDepth; maxDepth = vp.maxDepth;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Viewport& Viewport::operator= (const RECT& rct)
|
||||
{
|
||||
x = float(rct.left); y = float(rct.top);
|
||||
width = float(rct.right - rct.left);
|
||||
height = float(rct.bottom - rct.top);
|
||||
minDepth = 0.f; maxDepth = 1.f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Viewport& Viewport::operator= (const D3D11_VIEWPORT& vp)
|
||||
{
|
||||
x = vp.TopLeftX; y = vp.TopLeftY;
|
||||
width = vp.Width; height = vp.Height;
|
||||
minDepth = vp.MinDepth; maxDepth = vp.MaxDepth;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Viewport operations
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline float Viewport::AspectRatio() const
|
||||
{
|
||||
if (width == 0.f || height == 0.f)
|
||||
return 0.f;
|
||||
|
||||
return (width / height);
|
||||
}
|
||||
|
||||
inline Vector3 Viewport::Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world) const
|
||||
{
|
||||
using namespace DirectX;
|
||||
XMVECTOR v = XMLoadFloat3(&p);
|
||||
XMMATRIX projection = XMLoadFloat4x4(&proj);
|
||||
v = XMVector3Project(v, x, y, width, height, minDepth, maxDepth, projection, view, world);
|
||||
Vector3 result;
|
||||
XMStoreFloat3(&result, v);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void Viewport::Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result) const
|
||||
{
|
||||
using namespace DirectX;
|
||||
XMVECTOR v = XMLoadFloat3(&p);
|
||||
XMMATRIX projection = XMLoadFloat4x4(&proj);
|
||||
v = XMVector3Project(v, x, y, width, height, minDepth, maxDepth, projection, view, world);
|
||||
XMStoreFloat3(&result, v);
|
||||
}
|
||||
|
||||
inline Vector3 Viewport::Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world) const
|
||||
{
|
||||
using namespace DirectX;
|
||||
XMVECTOR v = XMLoadFloat3(&p);
|
||||
XMMATRIX projection = XMLoadFloat4x4(&proj);
|
||||
v = XMVector3Unproject(v, x, y, width, height, minDepth, maxDepth, projection, view, world);
|
||||
Vector3 result;
|
||||
XMStoreFloat3(&result, v);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void Viewport::Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result) const
|
||||
{
|
||||
using namespace DirectX;
|
||||
XMVECTOR v = XMLoadFloat3(&p);
|
||||
XMMATRIX projection = XMLoadFloat4x4(&proj);
|
||||
v = XMVector3Unproject(v, x, y, width, height, minDepth, maxDepth, projection, view, world);
|
||||
XMStoreFloat3(&result, v);
|
||||
}
|
||||
|
|
|
@ -13,21 +13,40 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <DirectXColors.h>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
// VS 2010 doesn't support explicit calling convention for std::function
|
||||
#ifndef DIRECTX_STD_CALLCONV
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
||||
#define DIRECTX_STD_CALLCONV
|
||||
#else
|
||||
#define DIRECTX_STD_CALLCONV __cdecl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
#if (DIRECTXMATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#define XM_CALLCONV __fastcall
|
||||
typedef const XMVECTOR& HXMVECTOR;
|
||||
typedef const XMMATRIX& FXMMATRIX;
|
||||
|
@ -61,8 +80,9 @@ namespace DirectX
|
|||
virtual ~SpriteBatch();
|
||||
|
||||
// Begin/End a batch of sprite drawing operations.
|
||||
void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred, _In_opt_ ID3D11BlendState* blendState = nullptr, _In_opt_ ID3D11SamplerState* samplerState = nullptr, _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr, _In_opt_ std::function<void()> setCustomShaders = nullptr, FXMMATRIX transformMatrix = MatrixIdentity);
|
||||
void End();
|
||||
void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred, _In_opt_ ID3D11BlendState* blendState = nullptr, _In_opt_ ID3D11SamplerState* samplerState = nullptr, _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr,
|
||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomShaders = nullptr, FXMMATRIX transformMatrix = MatrixIdentity);
|
||||
void __cdecl End();
|
||||
|
||||
// Draw overloads specifying position, origin and scale as XMFLOAT2.
|
||||
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, XMFLOAT2 const& position, FXMVECTOR color = Colors::White);
|
||||
|
@ -79,8 +99,11 @@ namespace DirectX
|
|||
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, RECT const& destinationRectangle, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
|
||||
|
||||
// Rotation mode to be applied to the sprite transformation
|
||||
void SetRotation( DXGI_MODE_ROTATION mode );
|
||||
DXGI_MODE_ROTATION GetRotation() const;
|
||||
void __cdecl SetRotation( DXGI_MODE_ROTATION mode );
|
||||
DXGI_MODE_ROTATION __cdecl GetRotation() const;
|
||||
|
||||
// Set viewport for sprite transformation
|
||||
void __cdecl SetViewport( const D3D11_VIEWPORT& viewPort );
|
||||
|
||||
private:
|
||||
// Private implementation.
|
||||
|
@ -92,7 +115,7 @@ namespace DirectX
|
|||
static const XMFLOAT2 Float2Zero;
|
||||
|
||||
// Prevent copying.
|
||||
SpriteBatch(SpriteBatch const&);
|
||||
SpriteBatch& operator= (SpriteBatch const&);
|
||||
SpriteBatch(SpriteBatch const&) DIRECTX_CTOR_DELETE
|
||||
SpriteBatch& operator= (SpriteBatch const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
||||
|
|
|
@ -15,6 +15,17 @@
|
|||
|
||||
#include "SpriteBatch.h"
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
|
@ -31,21 +42,26 @@ namespace DirectX
|
|||
SpriteFont& operator= (SpriteFont&& moveFrom);
|
||||
virtual ~SpriteFont();
|
||||
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
|
||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
|
||||
|
||||
XMVECTOR MeasureString(_In_z_ wchar_t const* text) const;
|
||||
XMVECTOR XM_CALLCONV MeasureString(_In_z_ wchar_t const* text) const;
|
||||
|
||||
float GetLineSpacing() const;
|
||||
void SetLineSpacing(float spacing);
|
||||
// Spacing properties
|
||||
float __cdecl GetLineSpacing() const;
|
||||
void __cdecl SetLineSpacing(float spacing);
|
||||
|
||||
wchar_t GetDefaultCharacter() const;
|
||||
void SetDefaultCharacter(wchar_t character);
|
||||
// Font properties
|
||||
wchar_t __cdecl GetDefaultCharacter() const;
|
||||
void __cdecl SetDefaultCharacter(wchar_t character);
|
||||
|
||||
bool ContainsCharacter(wchar_t character) const;
|
||||
bool __cdecl ContainsCharacter(wchar_t character) const;
|
||||
|
||||
// Custom layout/rendering
|
||||
Glyph const* __cdecl FindGlyph(wchar_t character) const;
|
||||
void GetSpriteSheet( ID3D11ShaderResourceView** texture ) const;
|
||||
|
||||
// Describes a single character glyph.
|
||||
struct Glyph
|
||||
|
@ -67,7 +83,7 @@ namespace DirectX
|
|||
static const XMFLOAT2 Float2Zero;
|
||||
|
||||
// Prevent copying.
|
||||
SpriteFont(SpriteFont const&);
|
||||
SpriteFont& operator= (SpriteFont const&);
|
||||
SpriteFont(SpriteFont const&) DIRECTX_CTOR_DELETE
|
||||
SpriteFont& operator= (SpriteFont const&) DIRECTX_CTOR_DELETE
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,18 +13,29 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
// VS 2010/2012 do not support =default =delete
|
||||
#ifndef DIRECTX_CTOR_DEFAULT
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
#define DIRECTX_CTOR_DEFAULT {}
|
||||
#define DIRECTX_CTOR_DELETE ;
|
||||
#else
|
||||
#define DIRECTX_CTOR_DEFAULT =default;
|
||||
#define DIRECTX_CTOR_DELETE =delete;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <DirectXMath.h>
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
#if (DIRECTXMATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
||||
#define XM_CALLCONV __fastcall
|
||||
typedef const XMVECTOR& HXMVECTOR;
|
||||
typedef const XMMATRIX& FXMMATRIX;
|
||||
|
@ -33,8 +44,7 @@ namespace DirectX
|
|||
// Vertex struct holding position and color information.
|
||||
struct VertexPositionColor
|
||||
{
|
||||
VertexPositionColor()
|
||||
{ }
|
||||
VertexPositionColor() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
VertexPositionColor(XMFLOAT3 const& position, XMFLOAT4 const& color)
|
||||
: position(position),
|
||||
|
@ -58,8 +68,7 @@ namespace DirectX
|
|||
// Vertex struct holding position and texture mapping information.
|
||||
struct VertexPositionTexture
|
||||
{
|
||||
VertexPositionTexture()
|
||||
{ }
|
||||
VertexPositionTexture() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
VertexPositionTexture(XMFLOAT3 const& position, XMFLOAT2 const& textureCoordinate)
|
||||
: position(position),
|
||||
|
@ -83,8 +92,7 @@ namespace DirectX
|
|||
// Vertex struct holding position and normal vector.
|
||||
struct VertexPositionNormal
|
||||
{
|
||||
VertexPositionNormal()
|
||||
{ }
|
||||
VertexPositionNormal() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
VertexPositionNormal(XMFLOAT3 const& position, XMFLOAT3 const& normal)
|
||||
: position(position),
|
||||
|
@ -108,8 +116,7 @@ namespace DirectX
|
|||
// Vertex struct holding position, color, and texture mapping information.
|
||||
struct VertexPositionColorTexture
|
||||
{
|
||||
VertexPositionColorTexture()
|
||||
{ }
|
||||
VertexPositionColorTexture() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
VertexPositionColorTexture(XMFLOAT3 const& position, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate)
|
||||
: position(position),
|
||||
|
@ -136,8 +143,7 @@ namespace DirectX
|
|||
// Vertex struct holding position, normal vector, and color information.
|
||||
struct VertexPositionNormalColor
|
||||
{
|
||||
VertexPositionNormalColor()
|
||||
{ }
|
||||
VertexPositionNormalColor() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
VertexPositionNormalColor(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color)
|
||||
: position(position),
|
||||
|
@ -164,8 +170,7 @@ namespace DirectX
|
|||
// Vertex struct holding position, normal vector, and texture mapping information.
|
||||
struct VertexPositionNormalTexture
|
||||
{
|
||||
VertexPositionNormalTexture()
|
||||
{ }
|
||||
VertexPositionNormalTexture() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
VertexPositionNormalTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT2 const& textureCoordinate)
|
||||
: position(position),
|
||||
|
@ -192,8 +197,7 @@ namespace DirectX
|
|||
// Vertex struct holding position, normal vector, color, and texture mapping information.
|
||||
struct VertexPositionNormalColorTexture
|
||||
{
|
||||
VertexPositionNormalColorTexture()
|
||||
{ }
|
||||
VertexPositionNormalColorTexture() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
VertexPositionNormalColorTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate)
|
||||
: position(position),
|
||||
|
@ -224,8 +228,7 @@ namespace DirectX
|
|||
// tangent, color (RGBA), and texture mapping information
|
||||
struct VertexPositionNormalTangentColorTexture
|
||||
{
|
||||
VertexPositionNormalTangentColorTexture()
|
||||
{ }
|
||||
VertexPositionNormalTangentColorTexture() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
XMFLOAT3 position;
|
||||
XMFLOAT3 normal;
|
||||
|
@ -270,8 +273,8 @@ namespace DirectX
|
|||
SetColor( color );
|
||||
}
|
||||
|
||||
void SetColor( XMFLOAT4 const& color ) { SetColor( XMLoadFloat4( &color ) ); }
|
||||
void XM_CALLCONV SetColor( FXMVECTOR color );
|
||||
void __cdecl SetColor( XMFLOAT4 const& icolor ) { SetColor( XMLoadFloat4( &icolor ) ); }
|
||||
void XM_CALLCONV SetColor( FXMVECTOR icolor );
|
||||
|
||||
static const int InputElementCount = 5;
|
||||
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
|
||||
|
@ -282,8 +285,7 @@ namespace DirectX
|
|||
// tangent, color (RGBA), texture mapping information, and skinning weights
|
||||
struct VertexPositionNormalTangentColorTextureSkinning : public VertexPositionNormalTangentColorTexture
|
||||
{
|
||||
VertexPositionNormalTangentColorTextureSkinning()
|
||||
{ }
|
||||
VertexPositionNormalTangentColorTextureSkinning() DIRECTX_CTOR_DEFAULT
|
||||
|
||||
uint32_t indices;
|
||||
uint32_t weights;
|
||||
|
@ -320,10 +322,10 @@ namespace DirectX
|
|||
SetBlendWeights( weights );
|
||||
}
|
||||
|
||||
void SetBlendIndices( XMUINT4 const& indices );
|
||||
void __cdecl SetBlendIndices( XMUINT4 const& iindices );
|
||||
|
||||
void SetBlendWeights( XMFLOAT4 const& weights ) { SetBlendWeights( XMLoadFloat4( &weights ) ); }
|
||||
void XM_CALLCONV SetBlendWeights( FXMVECTOR weights );
|
||||
void __cdecl SetBlendWeights( XMFLOAT4 const& iweights ) { SetBlendWeights( XMLoadFloat4( &iweights ) ); }
|
||||
void XM_CALLCONV SetBlendWeights( FXMVECTOR iweights );
|
||||
|
||||
static const int InputElementCount = 7;
|
||||
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
|
||||
|
|
|
@ -25,15 +25,13 @@
|
|||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (_WIN32_WINNT <= _WIN32_WINNT_WIN8)
|
||||
#error WIC is not supported on Windows Phone 8.0
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
|
@ -47,7 +45,7 @@
|
|||
namespace DirectX
|
||||
{
|
||||
// Standard version
|
||||
HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
|
||||
_In_ size_t wicDataSize,
|
||||
_Out_opt_ ID3D11Resource** texture,
|
||||
|
@ -55,7 +53,7 @@ namespace DirectX
|
|||
_In_ size_t maxsize = 0
|
||||
);
|
||||
|
||||
HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_Out_opt_ ID3D11Resource** texture,
|
||||
_Out_opt_ ID3D11ShaderResourceView** textureView,
|
||||
|
@ -63,8 +61,13 @@ namespace DirectX
|
|||
);
|
||||
|
||||
// Standard version with optional auto-gen mipmap support
|
||||
HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateWICTextureFromMemory( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
|
||||
_In_ size_t wicDataSize,
|
||||
_Out_opt_ ID3D11Resource** texture,
|
||||
|
@ -72,8 +75,13 @@ namespace DirectX
|
|||
_In_ size_t maxsize = 0
|
||||
);
|
||||
|
||||
HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateWICTextureFromFile( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_Out_opt_ ID3D11Resource** texture,
|
||||
_Out_opt_ ID3D11ShaderResourceView** textureView,
|
||||
|
@ -81,7 +89,7 @@ namespace DirectX
|
|||
);
|
||||
|
||||
// Extended version
|
||||
HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
|
||||
_In_ size_t wicDataSize,
|
||||
_In_ size_t maxsize,
|
||||
|
@ -94,7 +102,7 @@ namespace DirectX
|
|||
_Out_opt_ ID3D11ShaderResourceView** textureView
|
||||
);
|
||||
|
||||
HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
HRESULT __cdecl CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_In_ size_t maxsize,
|
||||
_In_ D3D11_USAGE usage,
|
||||
|
@ -107,8 +115,13 @@ namespace DirectX
|
|||
);
|
||||
|
||||
// Extended version with optional auto-gen mipmap support
|
||||
HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateWICTextureFromMemoryEx( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
|
||||
_In_ size_t wicDataSize,
|
||||
_In_ size_t maxsize,
|
||||
|
@ -121,8 +134,13 @@ namespace DirectX
|
|||
_Out_opt_ ID3D11ShaderResourceView** textureView
|
||||
);
|
||||
|
||||
HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
HRESULT __cdecl CreateWICTextureFromFileEx( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContextX* d3dContext,
|
||||
#else
|
||||
HRESULT __cdecl CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
|
||||
_In_opt_ ID3D11DeviceContext* d3dContext,
|
||||
#endif
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_In_ size_t maxsize,
|
||||
_In_ D3D11_USAGE usage,
|
||||
|
|
|
@ -19,19 +19,13 @@
|
|||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if !defined(_XBOX_ONE) || !defined(_TITLE)
|
||||
#error This module only supports Xbox One exclusive apps
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -46,8 +40,7 @@ namespace Xbox
|
|||
DDS_ALPHA_MODE_CUSTOM = 4,
|
||||
};
|
||||
|
||||
HRESULT CreateDDSTextureFromMemory( _In_ ID3D11Device1* d3dDevice,
|
||||
_In_ ID3DXboxPerformanceDevice* perfDevice,
|
||||
HRESULT __cdecl CreateDDSTextureFromMemory( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
|
||||
_In_ size_t ddsDataSize,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
|
@ -57,8 +50,7 @@ namespace Xbox
|
|||
_In_ bool forceSRGB = false
|
||||
);
|
||||
|
||||
HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device1* d3dDevice,
|
||||
_In_ ID3DXboxPerformanceDevice* perfDevice,
|
||||
HRESULT __cdecl CreateDDSTextureFromFile( _In_ ID3D11DeviceX* d3dDevice,
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -35,40 +35,40 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
Loading…
Add table
Reference in a new issue