mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Let shapes choose lit or flat shading, and say how a renderer that cannot drape falls back
ShapeItem.lit picks the renderer's fixed light or a flat colour; omitted, extruded shapes and boxes are lit and the rest flat, as they were. The Cesium draw port lights unclamped colour and image fills by it; clamped shapes still drape unlit. A new reference scene, shapes-lit, draws a lit and a flat box and square. LineItem.mode now says a renderer that cannot drape at all draws draped lines and clamped shapes as overlay, and clampState() says overlay. The Cesium port says overlay when its context has no depth textures, which only a WebGL 1 context can lack.
This commit is contained in:
1 parent
8fe8b8e14d
commit
e15cfb3e32
6 files changed
+87
-9
No files matched your search
@@ -15,6 +15,7 @@
|
||||
"models-oblique.png",
|
||||
"city-orbit.png",
|
||||
"city-city.png",
|
||||
"city-street.png"
|
||||
"city-street.png",
|
||||
"shapes-lit-tilted.png"
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -325,6 +325,53 @@ export const REFERENCE_SCENES = Object.freeze([
|
||||
{ name: 'tilted', view: over(2500, -0.5, 0.3, offset(0, -3600)) },
|
||||
],
|
||||
},
|
||||
{
|
||||
// `ShapeItem.lit`: a lit box's faces shade apart, an unlit one's match;
|
||||
// a flat square lit, beside one drawn flat. Lit, the default renderer
|
||||
// shades a flat square's two triangles apart (a seam on the diagonal):
|
||||
// that is its lighting, recorded as it is.
|
||||
id: 'shapes-lit',
|
||||
family: 'shapes',
|
||||
capability: null,
|
||||
async build(r) {
|
||||
await bare(r);
|
||||
const set = r.draw.shapes({ id: 'ref:shapes-lit' });
|
||||
const square = (east, north, half) => [
|
||||
offset(east - half, north - half, 5),
|
||||
offset(east + half, north - half, 5),
|
||||
offset(east + half, north + half, 5),
|
||||
offset(east - half, north + half, 5),
|
||||
];
|
||||
const box = (id, east, lit) => ({
|
||||
id,
|
||||
geometry: {
|
||||
kind: 'box',
|
||||
center: offset(east, 300, 150),
|
||||
dimensions: { x: 300, y: 300, z: 300 },
|
||||
},
|
||||
fill: '#ff9f0a',
|
||||
lit,
|
||||
});
|
||||
set.set([
|
||||
box('lit-box', -400, true),
|
||||
box('flat-box', 400, false),
|
||||
{
|
||||
id: 'lit-square',
|
||||
geometry: { kind: 'polygon', rings: [square(-400, -500, 200)] },
|
||||
fill: '#0a84ff',
|
||||
lit: true,
|
||||
},
|
||||
{
|
||||
id: 'flat-square',
|
||||
geometry: { kind: 'polygon', rings: [square(400, -500, 200)] },
|
||||
fill: '#0a84ff',
|
||||
lit: false,
|
||||
},
|
||||
]);
|
||||
return disposeAll(set);
|
||||
},
|
||||
views: [{ name: 'tilted', view: over(2500, -0.5, 0.3, offset(0, -3600)) }],
|
||||
},
|
||||
{
|
||||
id: 'models',
|
||||
family: 'models',
|
||||
|
||||
Reference in new issue
Block a user