aboutsummaryrefslogtreecommitdiff
path: root/tools/ArtistTools/source/CoreLib/Scene
diff options
context:
space:
mode:
authorAnton Novoselov <[email protected]>2017-08-14 16:41:28 +0300
committerAnton Novoselov <[email protected]>2017-08-14 16:41:28 +0300
commit9a1c1d814f3fa0b54b49d90b43130c02bc280f44 (patch)
treeeae6ead883173c66619c30b6a1ed085f3cb70f4d /tools/ArtistTools/source/CoreLib/Scene
parentUpdated to CL 22627414: (diff)
downloadblast-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/Scene')
-rw-r--r--tools/ArtistTools/source/CoreLib/Scene/Camera.cpp24
-rw-r--r--tools/ArtistTools/source/CoreLib/Scene/Camera.h1
-rw-r--r--tools/ArtistTools/source/CoreLib/Scene/SimpleScene.cpp2
3 files changed, 27 insertions, 0 deletions
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);
}