Combine all GenImageXNoise functions into one function (GenImageNoise)
This commit is contained in:
parent
36bf4372b8
commit
5ad0fdbc05
|
|
@ -15,7 +15,7 @@
|
||||||
{
|
{
|
||||||
"name": "RAYLIB_VERSION_MINOR",
|
"name": "RAYLIB_VERSION_MINOR",
|
||||||
"type": "INT",
|
"type": "INT",
|
||||||
"value": 5,
|
"value": 6,
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
{
|
{
|
||||||
"name": "RAYLIB_VERSION",
|
"name": "RAYLIB_VERSION",
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "4.5",
|
"value": "4.6-dev",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -1032,6 +1032,11 @@
|
||||||
"type": "Transform **",
|
"type": "Transform **",
|
||||||
"name": "framePoses",
|
"name": "framePoses",
|
||||||
"description": "Poses array by frame"
|
"description": "Poses array by frame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "char[32]",
|
||||||
|
"name": "name",
|
||||||
|
"description": "Animation name"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -2545,6 +2550,63 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "NoiseType",
|
||||||
|
"description": "Noise types",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"name": "NOISE_VALUE",
|
||||||
|
"value": 0,
|
||||||
|
"description": "Value noise"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NOISE_WHITE",
|
||||||
|
"value": 1,
|
||||||
|
"description": "White noise"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NOISE_PERLIN",
|
||||||
|
"value": 2,
|
||||||
|
"description": "Perlin noise"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NOISE_LAYERED_PERLIN",
|
||||||
|
"value": 3,
|
||||||
|
"description": "Layered perlin noise"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GradientType",
|
||||||
|
"description": "Gradient types",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"name": "GRADIENT_COLOR",
|
||||||
|
"value": 0,
|
||||||
|
"description": "Color gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GRADIENT_LINEAR",
|
||||||
|
"value": 1,
|
||||||
|
"description": "Horizontal gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GRADIENT_RADIAL",
|
||||||
|
"value": 2,
|
||||||
|
"description": "Vertical gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GRADIENT_SQUARE",
|
||||||
|
"value": 3,
|
||||||
|
"description": "Square gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GRADIENT_CONICAL",
|
||||||
|
"value": 4,
|
||||||
|
"description": "Conical gradient"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "PixelFormat",
|
"name": "PixelFormat",
|
||||||
"description": "Pixel formats",
|
"description": "Pixel formats",
|
||||||
|
|
@ -6340,10 +6402,14 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GenImageWhiteNoise",
|
"name": "GenImageNoise",
|
||||||
"description": "Generate image: white noise",
|
"description": "Generate image: noise",
|
||||||
"returnType": "Image",
|
"returnType": "Image",
|
||||||
"params": [
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "NoiseType",
|
||||||
|
"name": "type"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "width"
|
"name": "width"
|
||||||
|
|
@ -6353,35 +6419,8 @@
|
||||||
"name": "height"
|
"name": "height"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "float",
|
"type": "...",
|
||||||
"name": "factor"
|
"name": "args"
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "GenImagePerlinNoise",
|
|
||||||
"description": "Generate image: perlin noise",
|
|
||||||
"returnType": "Image",
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"type": "int",
|
|
||||||
"name": "width"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "int",
|
|
||||||
"name": "height"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "int",
|
|
||||||
"name": "offsetX"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "int",
|
|
||||||
"name": "offsetY"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "float",
|
|
||||||
"name": "scale"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ return {
|
||||||
{
|
{
|
||||||
name = "RAYLIB_VERSION_MINOR",
|
name = "RAYLIB_VERSION_MINOR",
|
||||||
type = "INT",
|
type = "INT",
|
||||||
value = 5,
|
value = 6,
|
||||||
description = ""
|
description = ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +27,7 @@ return {
|
||||||
{
|
{
|
||||||
name = "RAYLIB_VERSION",
|
name = "RAYLIB_VERSION",
|
||||||
type = "STRING",
|
type = "STRING",
|
||||||
value = "4.5",
|
value = "4.6-dev",
|
||||||
description = ""
|
description = ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -1032,6 +1032,11 @@ return {
|
||||||
type = "Transform **",
|
type = "Transform **",
|
||||||
name = "framePoses",
|
name = "framePoses",
|
||||||
description = "Poses array by frame"
|
description = "Poses array by frame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "char[32]",
|
||||||
|
name = "name",
|
||||||
|
description = "Animation name"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -2545,6 +2550,63 @@ return {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "NoiseType",
|
||||||
|
description = "Noise types",
|
||||||
|
values = {
|
||||||
|
{
|
||||||
|
name = "NOISE_VALUE",
|
||||||
|
value = 0,
|
||||||
|
description = "Value noise"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "NOISE_WHITE",
|
||||||
|
value = 1,
|
||||||
|
description = "White noise"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "NOISE_PERLIN",
|
||||||
|
value = 2,
|
||||||
|
description = "Perlin noise"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "NOISE_LAYERED_PERLIN",
|
||||||
|
value = 3,
|
||||||
|
description = "Layered perlin noise"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "GradientType",
|
||||||
|
description = "Gradient types",
|
||||||
|
values = {
|
||||||
|
{
|
||||||
|
name = "GRADIENT_COLOR",
|
||||||
|
value = 0,
|
||||||
|
description = "Color gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "GRADIENT_LINEAR",
|
||||||
|
value = 1,
|
||||||
|
description = "Horizontal gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "GRADIENT_RADIAL",
|
||||||
|
value = 2,
|
||||||
|
description = "Vertical gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "GRADIENT_SQUARE",
|
||||||
|
value = 3,
|
||||||
|
description = "Square gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "GRADIENT_CONICAL",
|
||||||
|
value = 4,
|
||||||
|
description = "Conical gradient"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "PixelFormat",
|
name = "PixelFormat",
|
||||||
description = "Pixel formats",
|
description = "Pixel formats",
|
||||||
|
|
@ -5038,25 +5100,14 @@ return {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "GenImageWhiteNoise",
|
name = "GenImageNoise",
|
||||||
description = "Generate image: white noise",
|
description = "Generate image: noise",
|
||||||
returnType = "Image",
|
returnType = "Image",
|
||||||
params = {
|
params = {
|
||||||
|
{type = "NoiseType", name = "type"},
|
||||||
{type = "int", name = "width"},
|
{type = "int", name = "width"},
|
||||||
{type = "int", name = "height"},
|
{type = "int", name = "height"},
|
||||||
{type = "float", name = "factor"}
|
{type = "...", name = "args"}
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "GenImagePerlinNoise",
|
|
||||||
description = "Generate image: perlin noise",
|
|
||||||
returnType = "Image",
|
|
||||||
params = {
|
|
||||||
{type = "int", name = "width"},
|
|
||||||
{type = "int", name = "height"},
|
|
||||||
{type = "int", name = "offsetX"},
|
|
||||||
{type = "int", name = "offsetY"},
|
|
||||||
{type = "float", name = "scale"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,9 +3,9 @@
|
||||||
<Defines count="56">
|
<Defines count="56">
|
||||||
<Define name="RAYLIB_H" type="GUARD" value="" desc="" />
|
<Define name="RAYLIB_H" type="GUARD" value="" desc="" />
|
||||||
<Define name="RAYLIB_VERSION_MAJOR" type="INT" value="4" desc="" />
|
<Define name="RAYLIB_VERSION_MAJOR" type="INT" value="4" desc="" />
|
||||||
<Define name="RAYLIB_VERSION_MINOR" type="INT" value="5" desc="" />
|
<Define name="RAYLIB_VERSION_MINOR" type="INT" value="6" desc="" />
|
||||||
<Define name="RAYLIB_VERSION_PATCH" type="INT" value="0" desc="" />
|
<Define name="RAYLIB_VERSION_PATCH" type="INT" value="0" desc="" />
|
||||||
<Define name="RAYLIB_VERSION" type="STRING" value="4.5" desc="" />
|
<Define name="RAYLIB_VERSION" type="STRING" value="4.6-dev" desc="" />
|
||||||
<Define name="__declspec(x)" type="MACRO" value="__attribute__((x))" desc="" />
|
<Define name="__declspec(x)" type="MACRO" value="__attribute__((x))" desc="" />
|
||||||
<Define name="RLAPI" type="UNKNOWN" value="__declspec(dllexport)" desc="We are building the library as a Win32 shared library (.dll)" />
|
<Define name="RLAPI" type="UNKNOWN" value="__declspec(dllexport)" desc="We are building the library as a Win32 shared library (.dll)" />
|
||||||
<Define name="PI" type="FLOAT" value="3.14159265358979323846" desc="" />
|
<Define name="PI" type="FLOAT" value="3.14159265358979323846" desc="" />
|
||||||
|
|
@ -210,11 +210,12 @@
|
||||||
<Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
|
<Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
|
||||||
<Field type="Transform *" name="bindPose" desc="Bones base transformation (pose)" />
|
<Field type="Transform *" name="bindPose" desc="Bones base transformation (pose)" />
|
||||||
</Struct>
|
</Struct>
|
||||||
<Struct name="ModelAnimation" fieldCount="4" desc="ModelAnimation">
|
<Struct name="ModelAnimation" fieldCount="5" desc="ModelAnimation">
|
||||||
<Field type="int" name="boneCount" desc="Number of bones" />
|
<Field type="int" name="boneCount" desc="Number of bones" />
|
||||||
<Field type="int" name="frameCount" desc="Number of animation frames" />
|
<Field type="int" name="frameCount" desc="Number of animation frames" />
|
||||||
<Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
|
<Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
|
||||||
<Field type="Transform **" name="framePoses" desc="Poses array by frame" />
|
<Field type="Transform **" name="framePoses" desc="Poses array by frame" />
|
||||||
|
<Field type="char[32]" name="name" desc="Animation name" />
|
||||||
</Struct>
|
</Struct>
|
||||||
<Struct name="Ray" fieldCount="2" desc="Ray, ray for raycasting">
|
<Struct name="Ray" fieldCount="2" desc="Ray, ray for raycasting">
|
||||||
<Field type="Vector3" name="position" desc="Ray position (origin)" />
|
<Field type="Vector3" name="position" desc="Ray position (origin)" />
|
||||||
|
|
@ -290,7 +291,7 @@
|
||||||
<Alias type="RenderTexture2D" name="RenderTexture" desc="RenderTexture2D, same as RenderTexture" />
|
<Alias type="RenderTexture2D" name="RenderTexture" desc="RenderTexture2D, same as RenderTexture" />
|
||||||
<Alias type="Camera" name="Camera3D" desc="Camera type fallback, defaults to Camera3D" />
|
<Alias type="Camera" name="Camera3D" desc="Camera type fallback, defaults to Camera3D" />
|
||||||
</Aliases>
|
</Aliases>
|
||||||
<Enums count="21">
|
<Enums count="23">
|
||||||
<Enum name="ConfigFlags" valueCount="15" desc="System/Window config flags">
|
<Enum name="ConfigFlags" valueCount="15" desc="System/Window config flags">
|
||||||
<Value name="FLAG_VSYNC_HINT" integer="64" desc="Set to try enabling V-Sync on GPU" />
|
<Value name="FLAG_VSYNC_HINT" integer="64" desc="Set to try enabling V-Sync on GPU" />
|
||||||
<Value name="FLAG_FULLSCREEN_MODE" integer="2" desc="Set to run program in fullscreen" />
|
<Value name="FLAG_FULLSCREEN_MODE" integer="2" desc="Set to run program in fullscreen" />
|
||||||
|
|
@ -538,6 +539,19 @@
|
||||||
<Value name="SHADER_ATTRIB_VEC3" integer="2" desc="Shader attribute type: vec3 (3 float)" />
|
<Value name="SHADER_ATTRIB_VEC3" integer="2" desc="Shader attribute type: vec3 (3 float)" />
|
||||||
<Value name="SHADER_ATTRIB_VEC4" integer="3" desc="Shader attribute type: vec4 (4 float)" />
|
<Value name="SHADER_ATTRIB_VEC4" integer="3" desc="Shader attribute type: vec4 (4 float)" />
|
||||||
</Enum>
|
</Enum>
|
||||||
|
<Enum name="NoiseType" valueCount="4" desc="Noise types">
|
||||||
|
<Value name="NOISE_VALUE" integer="0" desc="Value noise" />
|
||||||
|
<Value name="NOISE_WHITE" integer="1" desc="White noise" />
|
||||||
|
<Value name="NOISE_PERLIN" integer="2" desc="Perlin noise" />
|
||||||
|
<Value name="NOISE_LAYERED_PERLIN" integer="3" desc="Layered perlin noise" />
|
||||||
|
</Enum>
|
||||||
|
<Enum name="GradientType" valueCount="5" desc="Gradient types">
|
||||||
|
<Value name="GRADIENT_COLOR" integer="0" desc="Color gradient" />
|
||||||
|
<Value name="GRADIENT_LINEAR" integer="1" desc="Horizontal gradient" />
|
||||||
|
<Value name="GRADIENT_RADIAL" integer="2" desc="Vertical gradient" />
|
||||||
|
<Value name="GRADIENT_SQUARE" integer="3" desc="Square gradient" />
|
||||||
|
<Value name="GRADIENT_CONICAL" integer="4" desc="Conical gradient" />
|
||||||
|
</Enum>
|
||||||
<Enum name="PixelFormat" valueCount="21" desc="Pixel formats">
|
<Enum name="PixelFormat" valueCount="21" desc="Pixel formats">
|
||||||
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAYSCALE" integer="1" desc="8 bit per pixel (no alpha)" />
|
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAYSCALE" integer="1" desc="8 bit per pixel (no alpha)" />
|
||||||
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA" integer="2" desc="8*2 bpp (2 channels)" />
|
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA" integer="2" desc="8*2 bpp (2 channels)" />
|
||||||
|
|
@ -655,7 +669,7 @@
|
||||||
<Param type="unsigned int" name="frames" desc="" />
|
<Param type="unsigned int" name="frames" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
<Functions count="517">
|
<Functions count="516">
|
||||||
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
|
|
@ -1575,17 +1589,11 @@
|
||||||
<Param type="Color" name="col1" desc="" />
|
<Param type="Color" name="col1" desc="" />
|
||||||
<Param type="Color" name="col2" desc="" />
|
<Param type="Color" name="col2" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="GenImageWhiteNoise" retType="Image" paramCount="3" desc="Generate image: white noise">
|
<Function name="GenImageNoise" retType="Image" paramCount="4" desc="Generate image: noise">
|
||||||
|
<Param type="NoiseType" name="type" desc="" />
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
<Param type="float" name="factor" desc="" />
|
<Param type="..." name="args" desc="" />
|
||||||
</Function>
|
|
||||||
<Function name="GenImagePerlinNoise" retType="Image" paramCount="5" desc="Generate image: perlin noise">
|
|
||||||
<Param type="int" name="width" desc="" />
|
|
||||||
<Param type="int" name="height" desc="" />
|
|
||||||
<Param type="int" name="offsetX" desc="" />
|
|
||||||
<Param type="int" name="offsetY" desc="" />
|
|
||||||
<Param type="float" name="scale" desc="" />
|
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="GenImageCellular" retType="Image" paramCount="3" desc="Generate image: cellular algorithm, bigger tileSize means bigger cells">
|
<Function name="GenImageCellular" retType="Image" paramCount="3" desc="Generate image: cellular algorithm, bigger tileSize means bigger cells">
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
|
|
|
||||||
|
|
@ -215,8 +215,7 @@ GenImageGradientV|Image|(int width, int height, Color top, Color bottom);|
|
||||||
GenImageGradientH|Image|(int width, int height, Color left, Color right);|
|
GenImageGradientH|Image|(int width, int height, Color left, Color right);|
|
||||||
GenImageGradientRadial|Image|(int width, int height, float density, Color inner, Color outer);|
|
GenImageGradientRadial|Image|(int width, int height, float density, Color inner, Color outer);|
|
||||||
GenImageChecked|Image|(int width, int height, int checksX, int checksY, Color col1, Color col2);|
|
GenImageChecked|Image|(int width, int height, int checksX, int checksY, Color col1, Color col2);|
|
||||||
GenImageWhiteNoise|Image|(int width, int height, float factor);|
|
GenImageNoise|Image|(int width, int height, ... args);|
|
||||||
GenImagePerlinNoise|Image|(int width, int height, int offsetX, int offsetY, float scale);|
|
|
||||||
GenImageCellular|Image|(int width, int height, int tileSize);|
|
GenImageCellular|Image|(int width, int height, int tileSize);|
|
||||||
GenTextureMipmaps|void|(Texture2D *texture);|
|
GenTextureMipmaps|void|(Texture2D *texture);|
|
||||||
SetTextureFilter|void|(Texture2D texture, int filterMode);|
|
SetTextureFilter|void|(Texture2D texture, int filterMode);|
|
||||||
|
|
|
||||||
|
|
@ -1413,6 +1413,20 @@
|
||||||
<Param name="Color col2" />
|
<Param name="Color col2" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="GenImageNoise" func="yes">
|
||||||
|
<Overload retVal="Image" descr="Generate image: noise">
|
||||||
|
<Param name="NoiseType type" />
|
||||||
|
<Param name="int width" />
|
||||||
|
<Param name="int height" />
|
||||||
|
<Param name="float factor" />
|
||||||
|
<Param name="int offsetX" />
|
||||||
|
<Param name="int offsetY" />
|
||||||
|
<Param name="float scale" />
|
||||||
|
<Param name="float lacunarity" />
|
||||||
|
<Param name="float gain" />
|
||||||
|
<Param name="int octaves" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="GenImageWhiteNoise" func="yes">
|
<KeyWord name="GenImageWhiteNoise" func="yes">
|
||||||
<Overload retVal="Image" descr="Generate image: white noise">
|
<Overload retVal="Image" descr="Generate image: white noise">
|
||||||
<Param name="int width" />
|
<Param name="int width" />
|
||||||
|
|
|
||||||
|
|
@ -321,8 +321,7 @@ RLAPI Image GenImageGradientV(int width, int height, Color top, Color bottom);
|
||||||
RLAPI Image GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient
|
RLAPI Image GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient
|
||||||
RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
|
RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
|
||||||
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
|
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
|
||||||
RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise
|
RLAPI Image GenImageNoise(NoiseType type, int width, int height, ...); // Generate image: noise
|
||||||
RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise
|
|
||||||
RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells
|
RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells
|
||||||
RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data
|
RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data
|
||||||
|
|
||||||
|
|
|
||||||
22
src/raylib.h
22
src/raylib.h
|
|
@ -79,7 +79,7 @@
|
||||||
#ifndef RAYLIB_H
|
#ifndef RAYLIB_H
|
||||||
#define RAYLIB_H
|
#define RAYLIB_H
|
||||||
|
|
||||||
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
|
#include <stdarg.h> // Required for: va_list and for using ellipsis notation (...) for functions with varying arguments
|
||||||
|
|
||||||
#define RAYLIB_VERSION_MAJOR 4
|
#define RAYLIB_VERSION_MAJOR 4
|
||||||
#define RAYLIB_VERSION_MINOR 6
|
#define RAYLIB_VERSION_MINOR 6
|
||||||
|
|
@ -790,6 +790,23 @@ typedef enum {
|
||||||
SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float)
|
SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float)
|
||||||
} ShaderAttributeDataType;
|
} ShaderAttributeDataType;
|
||||||
|
|
||||||
|
// Noise types
|
||||||
|
typedef enum {
|
||||||
|
NOISE_VALUE = 0, // Value noise
|
||||||
|
NOISE_WHITE, // White noise
|
||||||
|
NOISE_PERLIN, // Perlin noise
|
||||||
|
NOISE_LAYERED_PERLIN // Layered perlin noise
|
||||||
|
} NoiseType;
|
||||||
|
|
||||||
|
// Gradient types
|
||||||
|
typedef enum {
|
||||||
|
GRADIENT_COLOR = 0, // Color gradient
|
||||||
|
GRADIENT_LINEAR, // Horizontal gradient
|
||||||
|
GRADIENT_RADIAL, // Vertical gradient
|
||||||
|
GRADIENT_SQUARE, // Square gradient
|
||||||
|
GRADIENT_CONICAL // Conical gradient
|
||||||
|
} GradientType;
|
||||||
|
|
||||||
// Pixel formats
|
// Pixel formats
|
||||||
// NOTE: Support depends on OpenGL version and platform
|
// NOTE: Support depends on OpenGL version and platform
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
@ -1243,8 +1260,7 @@ RLAPI Image GenImageGradientV(int width, int height, Color top, Color bottom);
|
||||||
RLAPI Image GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient
|
RLAPI Image GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient
|
||||||
RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
|
RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
|
||||||
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
|
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
|
||||||
RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise
|
RLAPI Image GenImageNoise(NoiseType type, int width, int height, ...); // Generate image: noise
|
||||||
RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise
|
|
||||||
RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells
|
RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells
|
||||||
RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data
|
RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data
|
||||||
|
|
||||||
|
|
|
||||||
100
src/rtextures.c
100
src/rtextures.c
|
|
@ -74,6 +74,7 @@
|
||||||
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3 or ES2
|
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3 or ES2
|
||||||
|
|
||||||
#include <stdlib.h> // Required for: malloc(), free()
|
#include <stdlib.h> // Required for: malloc(), free()
|
||||||
|
#include <stdarg.h> // Required for: using ellipsis notation (...) for functions with varying arguments
|
||||||
#include <string.h> // Required for: strlen() [Used in ImageTextEx()], strcmp() [Used in LoadImageFromMemory()]
|
#include <string.h> // Required for: strlen() [Used in ImageTextEx()], strcmp() [Used in LoadImageFromMemory()]
|
||||||
#include <math.h> // Required for: fabsf() [Used in DrawTextureRec()]
|
#include <math.h> // Required for: fabsf() [Used in DrawTextureRec()]
|
||||||
#include <stdio.h> // Required for: sprintf() [Used in ExportImageAsCode()]
|
#include <stdio.h> // Required for: sprintf() [Used in ExportImageAsCode()]
|
||||||
|
|
@ -802,32 +803,35 @@ Image GenImageChecked(int width, int height, int checksX, int checksY, Color col
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate image: white noise
|
Image GenImageNoise(NoiseType type, int width, int height, ...)
|
||||||
Image GenImageWhiteNoise(int width, int height, float factor)
|
|
||||||
{
|
{
|
||||||
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
Color *pixels = (Color *)malloc(width * height * sizeof(Color));
|
||||||
|
int argsCount = 0;
|
||||||
|
va_list args;
|
||||||
|
|
||||||
for (int i = 0; i < width*height; i++)
|
switch (type) {
|
||||||
{
|
case NOISE_VALUE: {
|
||||||
if (GetRandomValue(0, 99) < (int)(factor*100.0f)) pixels[i] = WHITE;
|
// Process the arguments for NOISE_VALUE if required
|
||||||
else pixels[i] = BLACK;
|
break;
|
||||||
}
|
}
|
||||||
|
case NOISE_WHITE: {
|
||||||
Image image = {
|
argsCount = 1;
|
||||||
.data = pixels,
|
va_start(args, argsCount);
|
||||||
.width = width,
|
float factor = (float)va_arg(args, double);
|
||||||
.height = height,
|
for (int i = 0; i < width * height; i++) {
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
if (rand() % 100 < (int)(factor * 100.0f))
|
||||||
.mipmaps = 1
|
pixels[i] = (Color){255, 255, 255, 255};
|
||||||
};
|
else
|
||||||
|
pixels[i] = (Color){0, 0, 0, 255};
|
||||||
return image;
|
}
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
// Generate image: perlin noise
|
case NOISE_PERLIN: {
|
||||||
Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale)
|
argsCount = 3;
|
||||||
{
|
va_start(args, argsCount);
|
||||||
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
int offsetX = va_arg(args, int);
|
||||||
|
int offsetY = va_arg(args, int);
|
||||||
|
float scale = (float)va_arg(args, double);
|
||||||
|
|
||||||
for (int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
|
|
@ -857,12 +861,60 @@ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float
|
||||||
pixels[y*width + x] = (Color){ intensity, intensity, intensity, 255 };
|
pixels[y*width + x] = (Color){ intensity, intensity, intensity, 255 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NOISE_LAYERED_PERLIN: {
|
||||||
|
argsCount = 6;
|
||||||
|
va_start(args, argsCount);
|
||||||
|
int offsetX = va_arg(args, int);
|
||||||
|
int offsetY = va_arg(args, int);
|
||||||
|
float scale = (float)va_arg(args, double);
|
||||||
|
float lacunarity = (float)va_arg(args, double);
|
||||||
|
float gain = (float)va_arg(args, double);
|
||||||
|
int octaves = va_arg(args, int);
|
||||||
|
|
||||||
|
// Generate layered Perlin noise image
|
||||||
|
for (int y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
float nx = (float)(x + offsetX)*(scale/(float)width);
|
||||||
|
float ny = (float)(y + offsetY)*(scale/(float)height);
|
||||||
|
|
||||||
|
// Basic perlin noise implementation (not used)
|
||||||
|
//float p = (stb_perlin_noise3(nx, ny, 0.0f, 0, 0, 0);
|
||||||
|
|
||||||
|
// Calculate a better perlin noise using fbm (fractal brownian motion)
|
||||||
|
// Typical values to start playing with:
|
||||||
|
// lacunarity = ~2.0 -- spacing between successive octaves (use exactly 2.0 for wrapping output)
|
||||||
|
// gain = 0.5 -- relative weighting applied to each successive octave
|
||||||
|
// octaves = 6 -- number of "octaves" of noise3() to sum
|
||||||
|
float p = stb_perlin_fbm_noise3(nx, ny, 1.0f, lacunarity, gain, octaves);
|
||||||
|
|
||||||
|
// Clamp between -1.0f and 1.0f
|
||||||
|
if(p < -1.0f) p = -1.0f;
|
||||||
|
if(p > 1.0f) p = 1.0f;
|
||||||
|
|
||||||
|
// We need to normalize the data from [-1..1] to [0..1]
|
||||||
|
float np = (p + 1.0f)/2.0f;
|
||||||
|
|
||||||
|
int intensity = (int)(np*255.0);
|
||||||
|
pixels[y*width + x] = (Color){ intensity, intensity, intensity, 255 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
Image image = {
|
Image image = {
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, // Update with the desired format
|
||||||
.mipmaps = 1
|
.mipmaps = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user