fix cursor capture bug #33.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
/[Ll]ibrary/
|
/[Ll]ibrary/
|
||||||
/[Tt]emp/
|
/[Tt]emp/
|
||||||
/[Oo]bj/
|
/[Oo]bj/
|
||||||
|
/[Ll]ogs/
|
||||||
/[Bb]uild/
|
/[Bb]uild/
|
||||||
/[Ww]iki/
|
/[Ww]iki/
|
||||||
/[Mm]isc/
|
/[Mm]isc/
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 89616e59e1cccb346bd4e959257990ca
|
guid: 89616e59e1cccb346bd4e959257990ca
|
||||||
timeCreated: 1477555207
|
|
||||||
licenseType: Pro
|
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
internalIDToNameTable: []
|
||||||
serializedVersion: 2
|
externalObjects: {}
|
||||||
|
serializedVersion: 10
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 0
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
correctGamma: 0
|
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
borderMipMap: 0
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
mipMapFadeDistanceStart: 1
|
mipMapFadeDistanceStart: 1
|
||||||
mipMapFadeDistanceEnd: 3
|
mipMapFadeDistanceEnd: 3
|
||||||
bumpmap:
|
bumpmap:
|
||||||
@@ -20,40 +21,71 @@ TextureImporter:
|
|||||||
heightScale: 0.25
|
heightScale: 0.25
|
||||||
normalMapFilter: 0
|
normalMapFilter: 0
|
||||||
isReadable: 0
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
grayScaleToAlpha: 0
|
grayScaleToAlpha: 0
|
||||||
generateCubemap: 0
|
generateCubemap: 6
|
||||||
cubemapConvolution: 0
|
cubemapConvolution: 0
|
||||||
cubemapConvolutionSteps: 7
|
|
||||||
cubemapConvolutionExponent: 1.5
|
|
||||||
seamlessCubemap: 0
|
seamlessCubemap: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
textureSettings:
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
filterMode: 0
|
filterMode: 0
|
||||||
aniso: 1
|
aniso: 1
|
||||||
mipBias: -1
|
mipBias: -100
|
||||||
wrapMode: 1
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
nPOTScale: 0
|
nPOTScale: 0
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
rGBM: 0
|
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
spriteMode: 1
|
spriteMode: 1
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
spritePixelsToUnits: 100
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 1
|
||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 8
|
textureType: 8
|
||||||
buildTargetSettings: []
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
spriteSheet:
|
spriteSheet:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
sprites: []
|
sprites: []
|
||||||
outline: []
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -161,7 +161,7 @@ void Cursor::UpdateTexture(
|
|||||||
|
|
||||||
if (capturedImageRight >= desktopImageWidth)
|
if (capturedImageRight >= desktopImageWidth)
|
||||||
{
|
{
|
||||||
capturedImageWidth -= capturedImageRight - desktopImageWidth;
|
capturedImageWidth -= capturedImageRight - desktopImageWidth + 1;
|
||||||
capturedImageRight = desktopImageWidth - 1;
|
capturedImageRight = desktopImageWidth - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ void Cursor::UpdateTexture(
|
|||||||
|
|
||||||
if (capturedImageBottom >= desktopImageHeight)
|
if (capturedImageBottom >= desktopImageHeight)
|
||||||
{
|
{
|
||||||
capturedImageHeight -= capturedImageBottom - desktopImageHeight;
|
capturedImageHeight -= capturedImageBottom - desktopImageHeight + 1;
|
||||||
capturedImageBottom = desktopImageHeight - 1;
|
capturedImageBottom = desktopImageHeight - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,12 +193,7 @@ void Cursor::UpdateTexture(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capturedImageWidth == 0 || capturedImageHeight == 0)
|
capturedImageArea_ =
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
capturedImageArea_ = D3D11_BOX
|
|
||||||
{
|
{
|
||||||
static_cast<UINT>(capturedImageLeft),
|
static_cast<UINT>(capturedImageLeft),
|
||||||
static_cast<UINT>(capturedImageTop),
|
static_cast<UINT>(capturedImageTop),
|
||||||
@@ -208,12 +203,17 @@ void Cursor::UpdateTexture(
|
|||||||
1
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (capturedImageWidth == 0 || capturedImageHeight == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create texture for capturing desktop image
|
// Create texture for capturing desktop image
|
||||||
ComPtr<ID3D11Texture2D> texture;
|
ComPtr<ID3D11Texture2D> texture;
|
||||||
{
|
{
|
||||||
D3D11_TEXTURE2D_DESC desc;
|
D3D11_TEXTURE2D_DESC desc;
|
||||||
desc.Width = capturedImageWidth;
|
desc.Width = cursorImageWidth;
|
||||||
desc.Height = capturedImageHeight;
|
desc.Height = cursorImageHeight;
|
||||||
desc.MipLevels = 1;
|
desc.MipLevels = 1;
|
||||||
desc.ArraySize = 1;
|
desc.ArraySize = 1;
|
||||||
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||||
@@ -257,10 +257,6 @@ void Cursor::UpdateTexture(
|
|||||||
const auto desktop32 = reinterpret_cast<UINT*>(mappedSurface.pBits);
|
const auto desktop32 = reinterpret_cast<UINT*>(mappedSurface.pBits);
|
||||||
const UINT desktopPitch = mappedSurface.Pitch / sizeof(UINT);
|
const UINT desktopPitch = mappedSurface.Pitch / sizeof(UINT);
|
||||||
|
|
||||||
// Rotate cursor image to match the monitor orientation
|
|
||||||
Buffer<BYTE> rotatedBuffer_;
|
|
||||||
rotatedBuffer_.ExpandIfNeeded(buffer_.Size());
|
|
||||||
|
|
||||||
for (int y = 0; y < capturedImageHeight; ++y)
|
for (int y = 0; y < capturedImageHeight; ++y)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < capturedImageWidth; ++x)
|
for (int x = 0; x < capturedImageWidth; ++x)
|
||||||
@@ -382,6 +378,8 @@ void Cursor::Draw(const Microsoft::WRL::ComPtr<ID3D11Texture2D>& texture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto capturedImageWidth = capturedImageArea_.right - capturedImageArea_.left;
|
const auto capturedImageWidth = capturedImageArea_.right - capturedImageArea_.left;
|
||||||
|
if (capturedImageWidth == 0) return;
|
||||||
|
|
||||||
ComPtr<ID3D11DeviceContext> context;
|
ComPtr<ID3D11DeviceContext> context;
|
||||||
GetUnityDevice()->GetImmediateContext(&context);
|
GetUnityDevice()->GetImmediateContext(&context);
|
||||||
context->UpdateSubresource(texture.Get(), 0, &capturedImageArea_, bgraBuffer_.Get(), capturedImageWidth * 4, 0);
|
context->UpdateSubresource(texture.Get(), 0, &capturedImageArea_, bgraBuffer_.Get(), capturedImageWidth * 4, 0);
|
||||||
|
|||||||
@@ -89,7 +89,8 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy /Y "$(SolutionDir)$(Platform)\$(Configuration)\$(TargetFileName)" "$(SolutionDir)..\..\Assets\$(ProjectName)\Plugins\x86_64"</Command>
|
<Command>copy /Y "$(SolutionDir)$(Platform)\$(Configuration)\$(TargetFileName)" "$(SolutionDir)..\..\Assets\$(ProjectName)\Plugins\x86_64"</Command>
|
||||||
@@ -103,7 +104,8 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy /Y "$(SolutionDir)$(Platform)\$(Configuration)\$(TargetFileName)" "$(SolutionDir)..\..\Assets\$(ProjectName)\Plugins\x86"</Command>
|
<Command>copy /Y "$(SolutionDir)$(Platform)\$(Configuration)\$(TargetFileName)" "$(SolutionDir)..\..\Assets\$(ProjectName)\Plugins\x86"</Command>
|
||||||
@@ -118,8 +120,9 @@
|
|||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
@@ -137,8 +140,9 @@
|
|||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
|||||||
@@ -3,14 +3,33 @@
|
|||||||
--- !u!159 &1
|
--- !u!159 &1
|
||||||
EditorSettings:
|
EditorSettings:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 4
|
serializedVersion: 9
|
||||||
m_ExternalVersionControlSupport: Hidden Meta Files
|
m_ExternalVersionControlSupport: Hidden Meta Files
|
||||||
m_SerializationMode: 2
|
m_SerializationMode: 2
|
||||||
|
m_LineEndingsForNewScripts: 1
|
||||||
m_DefaultBehaviorMode: 0
|
m_DefaultBehaviorMode: 0
|
||||||
|
m_PrefabRegularEnvironment: {fileID: 0}
|
||||||
|
m_PrefabUIEnvironment: {fileID: 0}
|
||||||
m_SpritePackerMode: 0
|
m_SpritePackerMode: 0
|
||||||
m_SpritePackerPaddingPower: 1
|
m_SpritePackerPaddingPower: 1
|
||||||
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
|
m_EtcTextureCompressorBehavior: 0
|
||||||
|
m_EtcTextureFastCompressor: 2
|
||||||
|
m_EtcTextureNormalCompressor: 2
|
||||||
|
m_EtcTextureBestCompressor: 5
|
||||||
|
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmref
|
||||||
m_ProjectGenerationRootNamespace:
|
m_ProjectGenerationRootNamespace:
|
||||||
m_UserGeneratedProjectSuffix:
|
|
||||||
m_CollabEditorSettings:
|
m_CollabEditorSettings:
|
||||||
inProgressEnabled: 1
|
inProgressEnabled: 1
|
||||||
|
m_EnableTextureStreamingInEditMode: 1
|
||||||
|
m_EnableTextureStreamingInPlayMode: 1
|
||||||
|
m_AsyncShaderCompilation: 1
|
||||||
|
m_EnterPlayModeOptionsEnabled: 0
|
||||||
|
m_EnterPlayModeOptions: 3
|
||||||
|
m_ShowLightmapResolutionOverlay: 1
|
||||||
|
m_UseLegacyProbeSampleCount: 1
|
||||||
|
m_AssetPipelineMode: 1
|
||||||
|
m_CacheServerMode: 0
|
||||||
|
m_CacheServerEndpoint:
|
||||||
|
m_CacheServerNamespacePrefix: default
|
||||||
|
m_CacheServerEnableDownload: 1
|
||||||
|
m_CacheServerEnableUpload: 1
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
m_EditorVersion: 2018.2.20f1
|
m_EditorVersion: 2019.3.1f1
|
||||||
|
m_EditorVersionWithRevision: 2019.3.1f1 (89d6087839c2)
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!937362698 &1
|
||||||
|
VFXManager:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_IndirectShader: {fileID: 0}
|
||||||
|
m_CopyBufferShader: {fileID: 0}
|
||||||
|
m_SortShader: {fileID: 0}
|
||||||
|
m_StripUpdateShader: {fileID: 0}
|
||||||
|
m_RenderPipeSettingsPath:
|
||||||
|
m_FixedTimeStep: 0.016666668
|
||||||
|
m_MaxDeltaTime: 0.05
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"m_SettingKeys": [
|
||||||
|
"VR Device Disabled",
|
||||||
|
"VR Device User Alert"
|
||||||
|
],
|
||||||
|
"m_SettingValues": [
|
||||||
|
"False",
|
||||||
|
"False"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user