shader language declaring multiple floats?
Asked Answered
M

2

0

I am trying to understand this shader: https://godotshaders.com/shader/2d-liquid-fill-inside-sphere/

The shader is using a weird format where it says float and then the code on the next line is indented, with each line divided by a comma.
float

Just to make sure: The indent is just for readability and all that this means is that multiple float variables are being created? For example, in the screenshot, the float variables sdf, vB and vBA are creted?

Matamoros answered 21/10, 2023 at 20:49 Comment(0)
D
0

Matamoros It's a standard C syntax for declaring multiple variables.
Note that C doesn't care for whitespace, including newlines. So for example this is perfectly valid C code:

for
(int i 
	=0
	;i< 
		100; i
++){
				}
Dostie answered 21/10, 2023 at 21:49 Comment(0)
O
0

Unrelated to your question, but it could be helpful to check out the shadertoy it mentions in the comments, as that shader explains some of the variable names (and adds AA)

https://www.shadertoy.com/view/Ds3BRN

Obscenity answered 22/10, 2023 at 4:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.