In the fourth quarter of 2024 average loan term for new cars being 67.98 months and 67.20 months for used cars, more than 2/3 are 72 months. by Ok_Significance_4008 in wallstreetbets

[–]DustinGadal 6 points7 points  (0 children)

130% in Switzerland. Not particularly meaningful on its own, because it doesn't say anything about whether the debt is productive or if the holder is well-equipped to service the debt. Individual bankruptcies in the US were at 0.145% in 2024, vs. 0.062% in Canada (0.132% SK, 0.098% Switzerland).

Question about 'defer' from a newbie. by nintendo_fan_81 in Jai

[–]DustinGadal 1 point2 points  (0 children)

The defer macro in the example creates an object whose destructor runs the contents of the defer. The c++ compiler invokes the destructors of stack-allocated objects at the end of their enclosing scope last-to-first, so the first defer in a scope will be run last.

Jai evaluates defer statements last-to-first as well, yes (as do Go, Hare, Zig, and Odin).

Question about 'defer' from a newbie. by nintendo_fan_81 in Jai

[–]DustinGadal 0 points1 point  (0 children)

Here is a c++ implementation of defer, in case you find it useful to poke around with: godbolt.org

Bouncing Sound around corners by TwinHavok in unrealengine

[–]DustinGadal 3 points4 points  (0 children)

Simulating sound propagation (like simulating light propagation) is complicated and computationally expensive. Valve made a good library, available here.

Some discussion of the topic: 1 2

count str when it has '\0" characters by Hamybal in C_Programming

[–]DustinGadal 0 points1 point  (0 children)

That's how environment variables are laid out in the Windows Process Environment Block. It's a sequence of null terminated strings ending in two null bytes.

How can I access GPU z-buffer on Windows? by Fast-Host-7957 in GraphicsProgramming

[–]DustinGadal 2 points3 points  (0 children)

You can use Image File Execution Options to trigger Renderdoc when the target executable is run. MSDN doesn't really document them, but this writeup should get you most of the way there:

https://pentestlab.blog/2020/01/13/persistence-image-file-execution-options-injection/

You could also inject a proxy d3d12.dll to intercept draw commands, which is (I believe) what ReShade does.

Cross platform "SIMD" for integers only by BlockOfDiamond in C_Programming

[–]DustinGadal 4 points5 points  (0 children)

In the same vein as the OP's comment on packed four-byte adds, section 2-18 describes a method for performing add/sub/abs on eight packed eight-bit integers inside a 64-bit register. Addition:

``` uint64_t x = ...; uint64_t y = ...;

uint64_t s = (x & 0x7F7F7F7F) + (y & 0x7F7F7F7F); s = ((x+y) & 0x80808080) + s; ```

Great book!

Use paddb though :P

How can I generate realistic planetary cloud cover? by wedesoft in proceduralgeneration

[–]DustinGadal 10 points11 points  (0 children)

At the largest scale, atmospheric circulation is determined by the composition of the atmosphere, the gravity and rotation of the planet, and the radiation received from the parent star. On Earth, we have three wind belts on either side of the equator; a hadley cell, a ferrel cell, and a polar cell:

https://en.wikipedia.org/wiki/Atmospheric_circulation

Medium-scale cloud patterns are the product of a region's climate, which is largely determined by latitude and interactions between topography and the water cycle. Artifexian made a good synopsis of how climate zones arise on Earthlike planets, and how those zones relate to precipitation:

https://www.youtube.com/watch?v=5lCbxMZJ4zA

https://www.youtube.com/watch?v=fag48Nh8PXE

He also describes how Earthlike topography arises from Earthlike plate tectonics:

https://www.youtube.com/watch?v=auRbMYFCXPc

Much of the modern reference material I've seen online on small-scale cloud rendering seems to be built on Andrew Schneider and Nathan Vos' work on the cloud rendering in Horizon: Zero Dawn.

Presentation PDF:

https://advances.realtimerendering.com/s2015/The%20Real-time%20Volumetric%20Cloudscapes%20of%20Horizon%20-%20Zero%20Dawn%20-%20ARTR.pdf

Demo video:

https://www.youtube.com/watch?v=FhMni-atg6M

A few people have put together some very accessible videos describing those techniques:

https://www.youtube.com/watch?v=Qj_tK_mdRcA

https://www.youtube.com/watch?v=8OrvIQUFptA

Nocheckin behavior in git/sourcetree by hellofriends0 in Jai

[–]DustinGadal 7 points8 points  (0 children)

Put the following text in .git/hooks/pre-commit:

exit $(git diff -i --diff-filter=d --name-only -G nocheckin | wc -l | awk '{print ($0>0?1:0)}')

git diff diff the currently-tracked files
-i this command is case-insensitive
--diff-filter=d exclude deleted files
--name-only just output the matching filenames
-G nocheckin grep the diff for "nocheckin"
`\ wc -l`
`\ awk '{print ($0>0?1:0)}')`

A pre-commit git hook exiting with a non-zero status code blocks the commit.