diff options
| author | Anton Novoselov <[email protected]> | 2017-08-14 16:41:28 +0300 |
|---|---|---|
| committer | Anton Novoselov <[email protected]> | 2017-08-14 16:41:28 +0300 |
| commit | 9a1c1d814f3fa0b54b49d90b43130c02bc280f44 (patch) | |
| tree | eae6ead883173c66619c30b6a1ed085f3cb70f4d /tools/ArtistTools/source/CoreLib | |
| parent | Updated to CL 22627414: (diff) | |
| download | blast-9a1c1d814f3fa0b54b49d90b43130c02bc280f44.tar.xz blast-9a1c1d814f3fa0b54b49d90b43130c02bc280f44.zip | |
Updated to CL 22661993:
* docs updates
* authoring fixes
* asset view in sample fix
* latest blast_tools_and_samples-windows.zip
Diffstat (limited to 'tools/ArtistTools/source/CoreLib')
| -rw-r--r-- | tools/ArtistTools/source/CoreLib/CoreLib.cpp | 14 | ||||
| -rw-r--r-- | tools/ArtistTools/source/CoreLib/CoreLib.h | 1 | ||||
| -rw-r--r-- | tools/ArtistTools/source/CoreLib/PluginInterface.h | 1 | ||||
| -rw-r--r-- | tools/ArtistTools/source/CoreLib/Scene/Camera.cpp | 24 | ||||
| -rw-r--r-- | tools/ArtistTools/source/CoreLib/Scene/Camera.h | 1 | ||||
| -rw-r--r-- | tools/ArtistTools/source/CoreLib/Scene/SimpleScene.cpp | 2 |
6 files changed, 43 insertions, 0 deletions
diff --git a/tools/ArtistTools/source/CoreLib/CoreLib.cpp b/tools/ArtistTools/source/CoreLib/CoreLib.cpp index 057439c..ceeae6c 100644 --- a/tools/ArtistTools/source/CoreLib/CoreLib.cpp +++ b/tools/ArtistTools/source/CoreLib/CoreLib.cpp @@ -1009,6 +1009,20 @@ bool CoreLib::SimpleScene_FitCamera(atcore_float3& center, atcore_float3& extent } return valid; } +bool CoreLib::SimpleScene_ResetUpDir(bool zup) +{ + bool valid = true; + std::map<QString, PluginInterface*>::iterator it; + for (it = m_PluginInterfaces.begin(); it != m_PluginInterfaces.end(); it++) + { + if (!(it->second)->SimpleScene_ResetUpDir(zup)) + { + valid = false; + break; + } + } + return valid; +} bool CoreLib::SimpleScene_UpdateCamera() { std::map<QString, PluginInterface*>::iterator it; diff --git a/tools/ArtistTools/source/CoreLib/CoreLib.h b/tools/ArtistTools/source/CoreLib/CoreLib.h index 385ac73..740a7d0 100644 --- a/tools/ArtistTools/source/CoreLib/CoreLib.h +++ b/tools/ArtistTools/source/CoreLib/CoreLib.h @@ -65,6 +65,7 @@ public: bool SimpleScene_Draw_DX12(); bool SimpleScene_Draw_DX11(); bool SimpleScene_FitCamera(atcore_float3& center, atcore_float3& extents); + bool SimpleScene_ResetUpDir(bool zup); bool SimpleScene_UpdateCamera(); bool SimpleScene_DrawGround(); bool SimpleScene_DrawWind(); diff --git a/tools/ArtistTools/source/CoreLib/PluginInterface.h b/tools/ArtistTools/source/CoreLib/PluginInterface.h index 0fc531c..a86bf4d 100644 --- a/tools/ArtistTools/source/CoreLib/PluginInterface.h +++ b/tools/ArtistTools/source/CoreLib/PluginInterface.h @@ -80,6 +80,7 @@ public: virtual bool SimpleScene_Draw_DX12() = 0; virtual bool SimpleScene_Draw_DX11() = 0; virtual bool SimpleScene_FitCamera(atcore_float3& center, atcore_float3& extents) = 0; + virtual bool SimpleScene_ResetUpDir(bool zup) = 0; virtual bool SimpleScene_UpdateCamera() = 0; virtual bool SimpleScene_LoadSceneFromFbx(const char* dir, const char* fbxName) = 0; virtual bool SimpleScene_LoadProject(const char* dir, const char* file) = 0; diff --git a/tools/ArtistTools/source/CoreLib/Scene/Camera.cpp b/tools/ArtistTools/source/CoreLib/Scene/Camera.cpp index 2dba89a..326f846 100644 --- a/tools/ArtistTools/source/CoreLib/Scene/Camera.cpp +++ b/tools/ArtistTools/source/CoreLib/Scene/Camera.cpp @@ -865,3 +865,27 @@ void Camera::getScreenCoord(float x, float y, float z, int &sx, int &sy) } +void Camera::getWorldCoord(int sx, int sy, float &x, float &y, float &z) +{ + atcore_float4x4 view = (atcore_float4x4&)GetViewMatrix(); + atcore_float4x4 projection = (atcore_float4x4&)GetProjectionMatrix(); + + float w = GetWidth(); + float h = GetHeight(); + + atcore_float4x4 viewProjection = view * projection; + atcore_float4x4 viewProjectionIV = gfsdk_inverse(viewProjection); + + float nx = 2.0f * (sx / w) - 1.0f; + float ny = 1.0f - 2.0f * (sy / h); + float nz = 0.0f; + + atcore_float4 screenPoint = { nx, ny, nz, 1.0f }; + atcore_float4 pos = gfsdk_transform(viewProjectionIV, screenPoint); + + pos.w = 1.0f / pos.w; + + x = pos.x * pos.w; + y = pos.y * pos.w; + z = pos.z * pos.w; +} diff --git a/tools/ArtistTools/source/CoreLib/Scene/Camera.h b/tools/ArtistTools/source/CoreLib/Scene/Camera.h index 23fb0c6..c04252a 100644 --- a/tools/ArtistTools/source/CoreLib/Scene/Camera.h +++ b/tools/ArtistTools/source/CoreLib/Scene/Camera.h @@ -48,6 +48,7 @@ public: void Pan(const atcore_float2& delta); void getScreenCoord(float x, float y, float z, int &sx, int &sy); + void getWorldCoord(int sx, int sy, float &x, float &y, float &z); float GetZNear() { return _znear; } float GetZFar() { return _zfar; } diff --git a/tools/ArtistTools/source/CoreLib/Scene/SimpleScene.cpp b/tools/ArtistTools/source/CoreLib/Scene/SimpleScene.cpp index ddbf517..dd89e4d 100644 --- a/tools/ArtistTools/source/CoreLib/Scene/SimpleScene.cpp +++ b/tools/ArtistTools/source/CoreLib/Scene/SimpleScene.cpp @@ -932,6 +932,8 @@ void SimpleScene::ResetUpDir(bool zup) GlobalSettings::Inst().m_zup = zup; + CoreLib::Inst()->SimpleScene_ResetUpDir(zup); + SetProjectModified(true); } |