Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/math/noise.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,22 @@ p5.prototype.noiseDetail = function(lod, falloff) {
}
};

/**
* @private
* Returns the current number of octaves used by noise().
*/
p5.prototype._getNoiseOctaves = function() {
return perlin_octaves;
};

/**
* @private
* Returns the current falloff factor used by noise().
*/
p5.prototype._getNoiseAmpFalloff = function() {
return perlin_amp_falloff;
};

/**
* Sets the seed value for the <a href="#/p5/noise">noise()</a> function.
*
Expand Down
20 changes: 20 additions & 0 deletions src/webgl/p5.RendererGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,10 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
this._webGL2CompatibilityPrefix('frag', 'highp') +
defaultShaders.phongFrag,
{
uniforms: {
'int uNoiseOctaves': () => this._pInst._getNoiseOctaves(),
'float uNoiseAmpFalloff': () => this._pInst._getNoiseAmpFalloff()
},
vertex: {
'void beforeVertex': '() {}',
'vec3 getLocalPosition': '(vec3 position) { return position; }',
Expand Down Expand Up @@ -1887,6 +1891,10 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
this._webGL2CompatibilityPrefix('frag', 'mediump') +
defaultShaders.normalFrag,
{
uniforms: {
'int uNoiseOctaves': () => this._pInst._getNoiseOctaves(),
'float uNoiseAmpFalloff': () => this._pInst._getNoiseAmpFalloff()
},
vertex: {
'void beforeVertex': '() {}',
'vec3 getLocalPosition': '(vec3 position) { return position; }',
Expand Down Expand Up @@ -1922,6 +1930,10 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
this._webGL2CompatibilityPrefix('frag', 'mediump') +
defaultShaders.basicFrag,
{
uniforms: {
'int uNoiseOctaves': () => this._pInst._getNoiseOctaves(),
'float uNoiseAmpFalloff': () => this._pInst._getNoiseAmpFalloff()
},
vertex: {
'void beforeVertex': '() {}',
'vec3 getLocalPosition': '(vec3 position) { return position; }',
Expand Down Expand Up @@ -1981,6 +1993,10 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
this._webGL2CompatibilityPrefix('frag', 'mediump') +
defaultShaders.pointFrag,
{
uniforms: {
'int uNoiseOctaves': () => this._pInst._getNoiseOctaves(),
'float uNoiseAmpFalloff': () => this._pInst._getNoiseAmpFalloff()
},
vertex: {
'void beforeVertex': '() {}',
'vec3 getLocalPosition': '(vec3 position) { return position; }',
Expand Down Expand Up @@ -2013,6 +2029,10 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
this._webGL2CompatibilityPrefix('frag', 'mediump') +
defaultShaders.lineFrag,
{
uniforms: {
'int uNoiseOctaves': () => this._pInst._getNoiseOctaves(),
'float uNoiseAmpFalloff': () => this._pInst._getNoiseAmpFalloff()
},
vertex: {
'void beforeVertex': '() {}',
'vec3 getLocalPosition': '(vec3 position) { return position; }',
Expand Down