Skip to content

Commit

Permalink
C Rename FNL_CELLULAR_RETURN_VALUE_ to FNL_CELLULAR_RETURN_TYPE_ to m…
Browse files Browse the repository at this point in the history
…atch variable name and other ports
  • Loading branch information
Auburn committed Feb 20, 2024
1 parent 3e8031c commit d5d42d9
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions C/FastNoiseLite.h
Expand Up @@ -103,13 +103,13 @@ typedef enum

typedef enum
{
FNL_CELLULAR_RETURN_VALUE_CELLVALUE,
FNL_CELLULAR_RETURN_VALUE_DISTANCE,
FNL_CELLULAR_RETURN_VALUE_DISTANCE2,
FNL_CELLULAR_RETURN_VALUE_DISTANCE2ADD,
FNL_CELLULAR_RETURN_VALUE_DISTANCE2SUB,
FNL_CELLULAR_RETURN_VALUE_DISTANCE2MUL,
FNL_CELLULAR_RETURN_VALUE_DISTANCE2DIV,
FNL_CELLULAR_RETURN_TYPE_CELLVALUE,
FNL_CELLULAR_RETURN_TYPE_DISTANCE,
FNL_CELLULAR_RETURN_TYPE_DISTANCE2,
FNL_CELLULAR_RETURN_TYPE_DISTANCE2ADD,
FNL_CELLULAR_RETURN_TYPE_DISTANCE2SUB,
FNL_CELLULAR_RETURN_TYPE_DISTANCE2MUL,
FNL_CELLULAR_RETURN_TYPE_DISTANCE2DIV,
} fnl_cellular_return_type;

typedef enum
Expand Down Expand Up @@ -189,13 +189,13 @@ typedef struct fnl_state

/**
* The distance function used in cellular noise calculations.
* @remark Default: FNL_CELLULAR_FUNC_DISTANCE
* @remark Default: FNL_CELLULAR_DISTANCE_EUCLIDEANSQ
*/
fnl_cellular_distance_func cellular_distance_func;

/**
* The cellular return type from cellular noise calculations.
* @remark Default: FNL_CELLULAR_RETURN_VALUE_EUCLIEANSQ
* @remark Default: FNL_CELLULAR_RETURN_TYPE_DISTANCE
*/
fnl_cellular_return_type cellular_return_type;

Expand Down Expand Up @@ -1496,28 +1496,28 @@ static float _fnlSingleCellular2D(fnl_state *state, int seed, FNLfloat x, FNLflo
break;
}

if (state->cellular_distance_func == FNL_CELLULAR_DISTANCE_EUCLIDEAN && state->cellular_return_type >= FNL_CELLULAR_RETURN_VALUE_DISTANCE)
if (state->cellular_distance_func == FNL_CELLULAR_DISTANCE_EUCLIDEAN && state->cellular_return_type >= FNL_CELLULAR_RETURN_TYPE_DISTANCE)
{
distance0 = _fnlFastSqrt(distance0);
if (state->cellular_return_type >= FNL_CELLULAR_RETURN_VALUE_DISTANCE2)
if (state->cellular_return_type >= FNL_CELLULAR_RETURN_TYPE_DISTANCE2)
distance1 = _fnlFastSqrt(distance1);
}

switch (state->cellular_return_type)
{
case FNL_CELLULAR_RETURN_VALUE_CELLVALUE:
case FNL_CELLULAR_RETURN_TYPE_CELLVALUE:
return closestHash * (1 / 2147483648.0f);
case FNL_CELLULAR_RETURN_VALUE_DISTANCE:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE:
return distance0 - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2:
return distance1 - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2ADD:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2ADD:
return (distance1 + distance0) * 0.5f - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2SUB:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2SUB:
return distance1 - distance0 - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2MUL:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2MUL:
return distance1 * distance0 * 0.5f - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2DIV:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2DIV:
return distance0 / distance1 - 1;
default:
return 0;
Expand Down Expand Up @@ -1645,28 +1645,28 @@ static float _fnlSingleCellular3D(fnl_state *state, int seed, FNLfloat x, FNLflo
break;
}

if (state->cellular_distance_func == FNL_CELLULAR_DISTANCE_EUCLIDEAN && state->cellular_return_type >= FNL_CELLULAR_RETURN_VALUE_DISTANCE)
if (state->cellular_distance_func == FNL_CELLULAR_DISTANCE_EUCLIDEAN && state->cellular_return_type >= FNL_CELLULAR_RETURN_TYPE_DISTANCE)
{
distance0 = _fnlFastSqrt(distance0);
if (state->cellular_return_type >= FNL_CELLULAR_RETURN_VALUE_DISTANCE2)
if (state->cellular_return_type >= FNL_CELLULAR_RETURN_TYPE_DISTANCE2)
distance1 = _fnlFastSqrt(distance1);
}

switch (state->cellular_return_type)
{
case FNL_CELLULAR_RETURN_VALUE_CELLVALUE:
case FNL_CELLULAR_RETURN_TYPE_CELLVALUE:
return closestHash * (1 / 2147483648.0f);
case FNL_CELLULAR_RETURN_VALUE_DISTANCE:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE:
return distance0 - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2:
return distance1 - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2ADD:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2ADD:
return (distance1 + distance0) * 0.5f - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2SUB:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2SUB:
return distance1 - distance0 - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2MUL:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2MUL:
return distance1 * distance0 * 0.5f - 1;
case FNL_CELLULAR_RETURN_VALUE_DISTANCE2DIV:
case FNL_CELLULAR_RETURN_TYPE_DISTANCE2DIV:
return distance0 / distance1 - 1;
default:
return 0;
Expand Down Expand Up @@ -2350,7 +2350,7 @@ fnl_state fnlCreateState()
newState.weighted_strength = 0.0f;
newState.ping_pong_strength = 2.0f;
newState.cellular_distance_func = FNL_CELLULAR_DISTANCE_EUCLIDEANSQ;
newState.cellular_return_type = FNL_CELLULAR_RETURN_VALUE_DISTANCE;
newState.cellular_return_type = FNL_CELLULAR_RETURN_TYPE_DISTANCE;
newState.cellular_jitter_mod = 1.0f;
newState.domain_warp_amp = 30.0f;
newState.domain_warp_type = FNL_DOMAIN_WARP_OPENSIMPLEX2;
Expand Down

0 comments on commit d5d42d9

Please sign in to comment.