mellinoe / ShaderGen

Proof-of-concept library for generating HLSL, GLSL, and Metal shader code from C#,
MIT License
497 stars 56 forks source link

How do you normalize? #86

Open equinox2k opened 5 years ago

equinox2k commented 5 years ago

Trying to work out how to normalize a vector?

Is there any documentation as also trying to understand the register attribute and why numbers can be repeated?

mellinoe commented 5 years ago

You can normalize a vector using Vector2/3/4.Normalize.

Not sure what you mean about the register attribute, could you clarify?

equinox2k commented 5 years ago

@mellinoe sorry I meant ResourceSet as per example

https://github.com/mellinoe/veldrid-samples/blob/master/src/TexturedCube/Application/Shaders/Cube.cs

Teaches me not to try and guess things from memory :)

mellinoe commented 5 years ago

That attribute is used to configure which Veldrid ResourceSet a field will go into. These correspond to descriptor sets in Vulkan terminology. The best way to understand the attributes purpose would be to read Veldrid’s documentation about ResourceLayouts and ResourceSets.