Closed
Description
Edit from @davepagurek:
- It is unclear how materials should work inside p5.Geometry: some material properties (vertex colors) are included (and only sometimes; they are discarded if they are all the same), and others never are (e.g. specular material)
- To fix this:
- We should define clearly what properties are included in p5.Geometry
- To be more consistent, we should likely include all materials or no materials, and be explicit about which
- This probably means making a wrapper around p5.Geometry that also includes materials
- This probably means having a method to turn the above into a materilalless p5.Geometry
Original bug report:
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
- Internalization
- Friendly Errors
- Other (specify if possible)
p5.js version
1.7.0.0
Web browser and version
Chrome
Operating System
MacOSX
Steps to reproduce this
Hi all!,
I'm using the new geometry feature from this push #6287 , However I am having problems creating geometries with transparency, I would expect that using the function fill()
with alpha would generate a triangle with opacity, but the beginGeometry()
and endGeometry()
ignore the transparent component.
Am I doing something work?
let shape01;
let shape02;
let points = [];
function setup() {
renderer = createCanvas(600, 600, WEBGL);
points.push(new p5.Vector(-1, -1, 0));
points.push(new p5.Vector(-1, 1, 0));
points.push(new p5.Vector(1, -1, 0));
points.push(new p5.Vector(-1, -1, 0));
buildShape01();
buildShape02();
}
function draw() {
background(0);
model(shape01);
model(shape02);
}
function buildShape01() {
beginGeometry();
fill(255, 0, 0, 50);
beginShape();
for (let vec of points) {
vertex(vec.x*100, vec.y*100, vec.z*100);
}
endShape(CLOSE);
shape01 = endGeometry();
}
function buildShape02() {
beginGeometry();
fill(0, 255, 0, 150);
beginShape();
for (let vec of points) {
vertex(vec.x*200, vec.y*200, vec.z*200);
}
endShape(CLOSE);
shape02 = endGeometry();
}
https://editor.p5js.org/thomaslengeling/sketches/a6-7PZ9IR
Many Thanks!
Metadata
Metadata
Assignees
Type
Projects
Status
DONE! 🎉