New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hydra-synth

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydra-synth - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

.npmignore

3

example/index.js

@@ -22,3 +22,4 @@ //const Hydra = require('./../src/index.js')

// autoLoad: false
enableStreamCapture: true
enableStreamCapture: true,
detectAudio: false
})

@@ -25,0 +26,0 @@

@@ -33,2 +33,3 @@ const Output = require('./src/output.js')

this.renderAll = false
this.detectAudio = detectAudio

@@ -294,3 +295,3 @@ // boolean to store when to save screenshot

window.time = this.time
this.audio.tick()
if(this.detectAudio === true) this.audio.tick()
for (let i = 0; i < this.s.length; i++) {

@@ -297,0 +298,0 @@ this.s[i].tick(this.time)

{
"name": "hydra-synth",
"version": "1.0.16",
"version": "1.0.17",
"description": "base synth for hydra-editor",

@@ -24,3 +24,3 @@ "main": "index.js",

"author": "ojack",
"license": "MIT",
"license": "AGPL",
"bugs": {

@@ -27,0 +27,0 @@ "url": "https://github.com/ojack/hydra-synth/issues"

@@ -355,5 +355,5 @@ /* globals tex */

output.uniforms = Object.assign(output.uniforms, uniformObj)*/
output.render()
// output.render()
}
module.exports = GeneratorFactory

@@ -10,5 +10,7 @@ const transforms = require('./glsl-transforms.js')

])
// this.tex = this.regl.texture()
this.clear()
this.pingPongIndex = 0
// for each output, create two fbos to use for ping ponging
this.fbos = (Array(2)).fill().map(() => this.regl.framebuffer({

@@ -22,2 +24,4 @@ color: this.regl.texture({

}))
// array containing render passes
this.passes = []

@@ -27,11 +31,11 @@ // console.log("position", this.positionBuffer)

Object.keys(transforms).forEach((method) => {
Output.prototype[method] = function (...args) {
// console.log("applying", method, transforms[method])
this.applyTransform(transforms[method], args)
// Object.keys(transforms).forEach((method) => {
// Output.prototype[method] = function (...args) {
// // console.log("applying", method, transforms[method])
// this.applyTransform(transforms[method], args)
//
// return this
// }
// })
return this
}
})
Output.prototype.getCurrent = function () {

@@ -79,74 +83,32 @@ // console.log("get current",this.pingPongIndex )

}
this.compileFragShader()
return this
}
// this.compileFragShader()
Output.prototype.applyTransform = function (opts, args) {
if (opts.isSource) this.clear()
var fragAddition = opts.fragBody
if (opts.inputs) {
var uniforms = {}
// for each input on a given transform, add variable to shader header and add to body
opts.inputs.forEach((input, index) => {
const uniformName = input.name + this.transformIndex
this.frag = `
${this.fragHeader}
uniforms[uniformName] = args.length > index ? args[index] : input.default
// if argument is a function, pass time in as the parameter
if (args[index] && typeof args[index] === 'function') {
uniforms[uniformName] = function (context, props, batchId) {
return args[index](props.time)
}
void main () {
vec4 c = vec4(0, 0, 0, 0);
vec2 st = uv;
${this.fragBody}
gl_FragColor = c;
}
let header = ``
if (input.type === 'color') {
header = `uniform vec3 ${uniformName};`
} else if (input.type === 'float') {
header = `uniform float ${uniformName};`
} else if (input.type === 'image') {
header = `uniform sampler2D ${uniformName};`
if (args[index]) uniforms[uniformName] = () => args[index].getTexture()
}
this.fragHeader = `
${this.fragHeader}
${header}
`
let replaceString = '<' + index + '>'
fragAddition = fragAddition.replace(new RegExp(replaceString, 'g'), uniformName)
})
Object.assign(this.uniforms, uniforms)
}
if (opts.fragBody) {
// color transforms are added to end of shader, whereas coordinate transforms are added to the beginning
if (opts.transformType === 'color') {
this.fragBody = `
${this.fragBody}
${fragAddition}
`
} else {
this.fragBody = `
${fragAddition}
${this.fragBody}
`
}
}
this.transformIndex++
this.compileFragShader()
this.render()
`
return this
}
Output.prototype.compileFragShader = function () {
var frag = `
${this.fragHeader}
void main () {
vec4 c = vec4(0, 0, 0, 0);
vec2 st = uv;
${this.fragBody}
gl_FragColor = c;
}
`
// console.log("FRAG", frag)
this.frag = frag
}
// Output.prototype.compileFragShader = function () {
// var frag = `
// ${this.fragHeader}
//
// void main () {
// vec4 c = vec4(0, 0, 0, 0);
// vec2 st = uv;
// ${this.fragBody}
// gl_FragColor = c;
// }
// `
// // console.log("FRAG", frag)
// this.frag = frag
// }

@@ -153,0 +115,0 @@ Output.prototype.render = function () {

@@ -33,3 +33,3 @@ // to add: ripple: https://www.shadertoy.com/view/4djGzz

},
colorShift: {
rgbShift: {
type: 'renderpass',

@@ -36,0 +36,0 @@ glsl: `

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc