Skip to content

Commit 2dd00ce

Browse files
authored
Merge pull request #304 from Devsh-Graphics-Programming/danylo_system
Merge Dan
2 parents ffb71ef + 723695c commit 2dd00ce

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

include/matrix4SIMD.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,28 @@ class matrix4SIMD// : public AlignedBase<_NBL_SIMD_ALIGNMENT> don't inherit from
169169

170170
bool isBoxInFrustum(const aabbox3d<float>& bbox);
171171

172+
bool perspectiveTransformVect(core::vectorSIMDf& inOutVec)
173+
{
174+
transformVect(inOutVec);
175+
const bool inFront = inOutVec[3] > 0.f;
176+
inOutVec /= inOutVec.wwww();
177+
return inFront;
178+
}
179+
180+
core::vector2di fragCoordTransformVect(const core::vectorSIMDf& _in, const core::dimension2du& viewportDimensions)
181+
{
182+
core::vectorSIMDf pos(_in);
183+
pos.w = 1.f;
184+
if (perspectiveTransformVect(pos))
185+
core::vector2di(-0x80000000, -0x80000000);
186+
187+
pos[0] *= 0.5f;
188+
pos[1] *= 0.5f;
189+
pos[0] += 0.5f;
190+
pos[1] += 0.5f;
191+
192+
return core::vector2di(pos[0] * float(viewportDimensions.Width), pos[1] * float(viewportDimensions.Height));
193+
}
172194

173195
static inline matrix4SIMD buildProjectionMatrixPerspectiveFovRH(float fieldOfViewRadians, float aspectRatio, float zNear, float zFar);
174196
static inline matrix4SIMD buildProjectionMatrixPerspectiveFovLH(float fieldOfViewRadians, float aspectRatio, float zNear, float zFar);

include/nbl/system/ISystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class ISystem : public core::IReferenceCounted
372372
bool deleteDirectory(const system::path& p)
373373
{
374374
if (std::filesystem::exists(p))
375-
return std::filesystem::remove(p);
375+
return std::filesystem::remove_all(p);
376376
else
377377
return false;
378378
}

include/nbl/ui/CWindowManagerWin32.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,16 @@ namespace nbl::ui
295295
case ERT_CHANGE_CURSOR_VISIBILITY:
296296
{
297297
auto& params = req.changeCursorVisibilityParam;
298-
ShowCursor(params.visible);
298+
if(params.visible)
299+
{
300+
int ret = ShowCursor(true);
301+
while (ret < 0) ret = ShowCursor(true);
302+
}
303+
else
304+
{
305+
int ret = ShowCursor(false);
306+
while (ret >= 0) ret = ShowCursor(false);
307+
}
299308
break;
300309
}
301310
}
@@ -313,6 +322,10 @@ namespace nbl::ui
313322
{
314323
req.destroyWindowParam = std::move(params);
315324
}
325+
else if constexpr (std::is_same_v<RequestParams, SRequestParams_ChangeCursorVisibility&>)
326+
{
327+
req.changeCursorVisibilityParam = std::move(params);
328+
}
316329
}
317330

318331
bool wakeupPredicate() const { return true; }

0 commit comments

Comments
 (0)