ShaderMan icon indicating copy to clipboard operation
ShaderMan copied to clipboard

const float is always 0

Open JakubNei opened this issue 6 years ago • 1 comments

Define should be used instead of const. Anything const seems to be always equal to 0 regardless of what you set it to.

Example:

const float MAX_TRACE_DISTANCE = 20.0;
const float INTERSECTION_PRECISION = 0.001;
const int NUM_OF_TRACE_STEPS = 100;

should be turned to

#define MAX_TRACE_DISTANCE 20.0
#define INTERSECTION_PRECISION 0.001
#define NUM_OF_TRACE_STEPS 100

JakubNei avatar Jun 12 '18 23:06 JakubNei

thanks for reporting this Issue I will fix It but now you can use this:

capture

add this regex to my code

Regex const\s*(float|int)([^=]*)\=([^;]*)\;

Substitution #define$2$3

https://regex101.com/

smkplus avatar Jun 13 '18 02:06 smkplus