Skip to content

[p5.js 2.0 Bug Report]: [p5.strands] Internal error creating varying values #8222

@davepagurek

Description

@davepagurek

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.0.5, 2.1-b1 (2.0.4+)

Web browser and version

Any

Operating system

Any

Steps to reproduce this

Steps:

  1. Create a p5.strands shader
  2. Create a varying variable using varying* as a prefix
    This throws an error.

Snippet:

let testShader
function setup() {
  createCanvas(400, 400, WEBGL);
  testShader = baseMaterialShader().modify(() => {
    let worldPos = varyingVector3()
    getWorldInputs((inputs) => {
      worldPos = inputs.position.xyz
      return inputs
    })
    getPixelInputs((inputs) => {
      inputs.color = [abs(worldPos * 0.01), 1]
      return inputs
    })
  })
}

function draw() {
  background(220);
  shader(testShader)
  sphere(100)
}

In 2.0.3 it produces this:

Image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions