Skip to content

[p5.js 2.0 Bug Report]: disableFriendlyErrors doesn't care about about custom vertex property with more values than vertices. #8037

@Iron-56

Description

@Iron-56

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

v2.0.4

Web browser and version

Any

Operating system

Any

Steps to reproduce this

Steps:

  1. Checkout to v2.0.4 tag
  2. Example code to reproduce issue:
function setup() {
        p5.disableFriendlyErrors = true;

        createCanvas(400, 400, WEBGL);
        
        let geom = new p5.Geometry();
        
        geom.vertices.push(createVector(0, 0, 0));
        geom.vertices.push(createVector(50, 0, 0)); 
        geom.vertices.push(createVector(25, 50, 0));
        geom.faces.push([0, 1, 2]);
        
        geom.computeNormals();
        
        console.log('Geometry created with', geom.vertices.length, 'vertices');
        
        geom.userVertexProperties = {
            'testProp': {
                getName() { return 'testProp'; },
                getSrcName() { return 'testPropSrc'; },
                getDstName() { return 'testPropBuffer'; },
                getSrcArray() {
                    return [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]; 
                },
                getDataSize() { return 1; }
            }
        };
        
        console.log('Property values:', geom.userVertexProperties.testProp.getSrcArray().length);
        console.log('Data size:', geom.userVertexProperties.testProp.getDataSize());
        console.log('Adjusted length:', geom.userVertexProperties.testProp.getSrcArray().length / geom.userVertexProperties.testProp.getDataSize());
        console.log('Should trigger error: 12 / 1 = 12 > 3 vertices');
        fill(255, 0, 0);
        noStroke();
        
        model(geom);
}

function draw() {
        background(200);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions