-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Adding light position configurability for surface
and mesh3d
, and general lighting configurability for the latter
#556
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
Changes from all commits
cd18bde
afed66a
af2f201
c9aa437
8b4c4b1
694a15a
401d3c3
d81c352
45c9e41
d300a9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,41 +147,76 @@ module.exports = { | |
].join(' ') | ||
}, | ||
|
||
lightposition: { | ||
x: { | ||
valType: 'number', | ||
role: 'style', | ||
min: -1e5, | ||
max: 1e5, | ||
dflt: 10, | ||
description: 'Numeric vector, representing the X coordinate for each vertex.' | ||
}, | ||
y: { | ||
valType: 'number', | ||
role: 'style', | ||
min: -1e5, | ||
max: 1e5, | ||
dflt: 1e5, | ||
description: 'Numeric vector, representing the Y coordinate for each vertex.' | ||
}, | ||
z: { | ||
valType: 'number', | ||
role: 'style', | ||
min: -1e5, | ||
max: 1e5, | ||
dflt: 0, | ||
description: 'Numeric vector, representing the Z coordinate for each vertex.' | ||
} | ||
}, | ||
|
||
lighting: { | ||
ambient: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0.00, | ||
max: 1.0, | ||
dflt: 0.8 | ||
dflt: 0.8, | ||
description: 'Ambient light increases overall color visibility but can wash out the image.' | ||
}, | ||
diffuse: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0.00, | ||
max: 1.00, | ||
dflt: 0.8 | ||
dflt: 0.8, | ||
description: 'Represents the extent that incident rays are reflected in a range of angles.' | ||
}, | ||
specular: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0.00, | ||
max: 2.00, | ||
dflt: 0.05 | ||
dflt: 0.05, | ||
description: 'Represents the level that incident rays are reflected in a single direction, causing shine.' | ||
}, | ||
roughness: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0.00, | ||
max: 1.00, | ||
dflt: 0.5 | ||
dflt: 0.5, | ||
description: 'Alters specular reflection; the rougher the surface, the wider and less contrasty the shine.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow. These descriptions are great. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙇 |
||
}, | ||
fresnel: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0.00, | ||
max: 5.00, | ||
dflt: 0.2 | ||
dflt: 0.2, | ||
description: [ | ||
'Represents the reflectance as a dependency of the viewing angle; e.g. paper is reflective', | ||
'when viewing it from the edge of the paper (almost 90 degrees), causing shine.' | ||
].join(' ') | ||
} | ||
}, | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,13 +50,19 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout | |
} | ||
} | ||
|
||
coerce('lighting.ambient'); | ||
coerce('lighting.diffuse'); | ||
coerce('lighting.specular'); | ||
coerce('lighting.roughness'); | ||
coerce('lighting.fresnel'); | ||
coerce('hidesurface'); | ||
coerce('opacity'); | ||
//Coerce remaining properties | ||
[ | ||
'lighting.ambient', | ||
'lighting.diffuse', | ||
'lighting.specular', | ||
'lighting.roughness', | ||
'lighting.fresnel', | ||
'lightposition.x', | ||
'lightposition.y', | ||
'lightposition.z', | ||
'hidesurface', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like you're not coercing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, initially I wasn't going to shoot for covering the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the But in this case, we should not add To do so:
lighting: extendFlat({}, surfaceAtts.lighting, {
vertexnormalepsilon: {
/* */
},
facenormalepsilon: {
/* */
}
}) |
||
'opacity' | ||
].forEach(function(x) { coerce(x); }); | ||
|
||
var surfaceColor = coerce('surfacecolor'); | ||
|
||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!