stephen-hqxu / superterrainplus

SuperTerrain+: A real-time procedural 3D infinite terrain engine with geographical features and photorealistic rendering.
MIT License
12 stars 1 forks source link

Shader type usage consistency #49

Closed stephen-hqxu closed 2 years ago

stephen-hqxu commented 2 years ago

Notice some inconsistent uses of types in many shaders, better to correct them for consistency.

Mixing unsigned int and uint

GLSL standard only defines uint as the valid type for unsigned integer, better to avoid unsigned int.

https://github.com/stephen-hqxu/superterrainplus/blob/8954eda5f00de90723ca87a1a23551ff180c5f56/SuperTerrain%2B/ModuleInterface/SuperRealism%2B/Shader/STPHeightfieldTerrain.frag#L32

Use of ^^^ unsigned int and vvv uint in the same file.

https://github.com/stephen-hqxu/superterrainplus/blob/8954eda5f00de90723ca87a1a23551ff180c5f56/SuperTerrain%2B/ModuleInterface/SuperRealism%2B/Shader/STPHeightfieldTerrain.frag#L175

Mixing float and int for textureLod function

textureLod function takes a float in the last argument.

https://github.com/stephen-hqxu/superterrainplus/blob/8954eda5f00de90723ca87a1a23551ff180c5f56/SuperTerrain%2B/ModuleInterface/SuperRealism%2B/Shader/STPBidirectionalScattering.frag#L38

^^^ Passing lod parameter as float and vvv as int.

https://github.com/stephen-hqxu/superterrainplus/blob/8954eda5f00de90723ca87a1a23551ff180c5f56/SuperTerrain%2B/ModuleInterface/SuperRealism%2B/Shader/STPAmbientOcclusion.frag#L48-L50

stephen-hqxu commented 2 years ago

There are also style inconsistency for layout qualifier:

https://github.com/stephen-hqxu/superterrainplus/blob/3836fc2c8a7bc77c4f3b026a0aadb8901f7298d4/SuperTerrain%2B/ModuleInterface/SuperRealism%2B/Shader/STPDeferredShading.frag#L104

^^^ Without space between layout and (...) vvv with space.

https://github.com/stephen-hqxu/superterrainplus/blob/3836fc2c8a7bc77c4f3b026a0aadb8901f7298d4/SuperTerrain%2B/ModuleInterface/SuperRealism%2B/Shader/STPHeightfieldTerrain.frag#L86