Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PShape.getSpecular(), .getEmissive(), and .getShininess() don't work correctly #781

Closed
hx2A opened this issue Sep 16, 2023 · 1 comment
Closed

Comments

@hx2A
Copy link
Contributor

hx2A commented Sep 16, 2023

Description

...but PShape.getAmbient() does work, which is an important clue. This is an obscure bug but don't worry, I will make a PR to fix this.

Those 3 methods return 0, regardless of what the PShape's material settings are.

Steps to Reproduce

Below is some code that demonstrates the problem.

size(300, 300, P3D);

PShape s = createShape();
s.beginShape();
s.vertex(-100, -100, 0);
s.vertex(100, -100, 0);
s.vertex(100, 100, 0);
s.vertex(-100, 100, 0);
s.endShape(CLOSE);

s.setAmbient(color(255, 204, 15));
s.setSpecular(color(13, 52, 29));
s.setEmissive(color(30, 20, 29));
s.setShininess(3);

translate(150, 150);

lights();

shape(s);

println("AMBIENT", hex(s.getAmbient(0)));
println("SPECULAR", hex(s.getSpecular(0)));
println("EMISSIVE", hex(s.getEmissive(0)));
println("SHININESS", s.getShininess(0));

The current output is:

AMBIENT FFFFCC0F
SPECULAR 00000000
EMISSIVE 00000000
SHININESS 0.0

The expected output is:

AMBIENT FFFFCC0F
SPECULAR FF0D341D
EMISSIVE FF1E141D
SHININESS 3.0

Your Environment

  • Processing version: 4.3
  • Operating System and OS version: Fedora Linux
  • Other information:

Possible Causes / Solutions

I see the problem and will make a PR for this.

@benfry
Copy link
Owner

benfry commented Sep 16, 2023

Excellent, thanks! Merged for what will likely be 4.3.1 (or whatever comes after 4.3).

benfry added a commit that referenced this issue Sep 16, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants