Skip to content

Commit

Permalink
Merge branch 'main' into post-processing-example
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarr committed Sep 12, 2023
2 parents 4a30c53 + 717be03 commit 61d4089
Show file tree
Hide file tree
Showing 16 changed files with 676 additions and 217 deletions.
44 changes: 31 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,42 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased - to be 0.4.1] - TBD
## 0.4.1 - 2023-08-08

### Changes and additions
* v2 save / load - includes environment
### What's Changed

### Major improvements
* v2 save / load - ability to edit a 3DStreet JSON file previously saved including environment and reference layers
* ability to load 3DStreet json file from third-party path (precursor to cloud)
* ability to update night / day live (street-environment component)
* ability to load json file from third-party path (precursor to cloud)
* improve asset loading - lazy load vehicles (only load vehicles when needed for scene)
* new LRV
* new bus model
* [Improved screenshot capture and capture modal (editor)](https://github.com/3DStreet/3dstreet/pull/277)
* [Improved support for varying levels of pedestrian densiy on sidewalk segments](https://github.com/3DStreet/3dstreet/pull/276)

### Changes and additions
* Sidewalk segment variants by @Algorush in https://github.com/3DStreet/3dstreet/pull/276
* add perpendicular parking option by @Algorush in https://github.com/3DStreet/3dstreet/pull/273
* New Screentock component by @kfarr in https://github.com/3DStreet/3dstreet/pull/277
* support new LRV by @kfarr in https://github.com/3DStreet/3dstreet/pull/289
* Lazy load rigged vehicles by @kfarr in https://github.com/3DStreet/3dstreet/pull/296
* Add first version to load JSON from URL by @Algorush in https://github.com/3DStreet/3dstreet/pull/304
* add update environment option by @Algorush in https://github.com/3DStreet/3dstreet/pull/307
* add environment node support by @Algorush in https://github.com/3DStreet/3dstreet/pull/300
* add attribute to ignore raycaster on env-sky element by @Algorush in https://github.com/3DStreet/3dstreet/pull/312
* Notification component by @Algorush in https://github.com/3DStreet/3dstreet/pull/319
* add layers-2d node support to save/load by @Algorush in https://github.com/3DStreet/3dstreet/pull/320
* rename layers-2 entity by @Algorush in https://github.com/3DStreet/3dstreet/pull/326
* fewer pedestrians in 'sparse' mode by @Algorush in https://github.com/3DStreet/3dstreet/pull/328
* Add console log for npm version number and github hash by @sweep-ai in https://github.com/3DStreet/3dstreet/pull/324
* brt station segment support by @Algorush https://github.com/3DStreet/3dstreet/pull/268

### Fixed
* ability to edit a street previously saved
* restore parallel parking t stencil
* fix empty lot / parking lot variants showing
* [Add perpindicular parking option](https://github.com/3DStreet/3dstreet/pull/273)
* [brt station support](https://github.com/3DStreet/3dstreet/pull/268)
* fix NaN issue with pedestrians by @Algorush in https://github.com/3DStreet/3dstreet/pull/283
* fix empty building variant showing by @Algorush in https://github.com/3DStreet/3dstreet/pull/285
* Save load fixing by @Algorush in https://github.com/3DStreet/3dstreet/pull/287
* Save load fixing by @Algorush in https://github.com/3DStreet/3dstreet/pull/310
* fix saving issue by @Algorush in https://github.com/3DStreet/3dstreet/pull/321
* return parking-t mixin by @Algorush in https://github.com/3DStreet/3dstreet/pull/302

**Full Changelog**: https://github.com/3DStreet/3dstreet/compare/0.4.0...0.4.1

## 0.4.0 - 2023-05-04

Expand Down
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 26 files
+ sets/brt-station/gltf-exports/draco/brt-station.glb
+ sets/cargo-bike-animation/gltf-exports/draco/cargo_bike_animation_v1.glb
+ sets/cyclist-animation/gltf-exports/draco/Dutch_cyclist_animation_v01.glb
+ sets/cyclist-animation/gltf-exports/draco/Kid_cyclist_animation_v01.glb
+ sets/cyclist-animation/gltf-exports/draco/cyclist-1-animation-v1.glb
+ sets/cyclist-animation/gltf-exports/draco/cyclist-2-animation-v1.glb
+ sets/cyclist-animation/gltf-exports/draco/cyclist-3-animation-v1.glb
+ sets/flyer-bus/gltf-exports/draco/new-flyer-bus.glb
+ sets/heart-model/heart-model_v01.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-1-walk.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-2-walk.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-3-walk.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-4-walk.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-5-walk.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-6-walk.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-7-walk.glb
+ sets/human-characters-animation-seperated/gltf-exports/draco/character-8-walk.glb
+ sets/human-characters-poses-1/gltf-exports/draco/human-characters-poses-1.glb
+ sets/human-characters-poses-2/gltf-exports/draco/human-characters-poses-2.glb
+ sets/light-rail-vehicle/gltf-exports/draco/light-rail-vehicle-v01.glb
+ sets/light-rail-vehicle/gltf-exports/draco/light-rail-vehicle-v02.glb
+ sets/magic-carpet/gltf-exports/draco/magic-carpet.glb
+ sets/vehicles-rig/gltf-exports/draco/fire-truck-pumper-rig.glb
+ sets/vehicles-rig/gltf-exports/draco/isuzu-truck-rig.glb
+ sets/vehicles/gltf-exports/draco/fire-truck-pumper.glb
+ sets/vehicles/gltf-exports/draco/isuzu-truck.glb
17 changes: 16 additions & 1 deletion dist/aframe-street-component.js

Large diffs are not rendered by default.

227 changes: 227 additions & 0 deletions index-intersection.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
<!DOCTYPE html>
<html>
<head>
<!-- aframe -->
<script src="https://aframe.io/releases/1.4.2/aframe.min.js"></script>

<!-- 3dstreet -->
<script src="https://github.3dstreet.org/dist/aframe-street-component.js"></script>

<!-- user controls - vr teleport -->

<!-- mapbox -->
<script src="https://github.3dstreet.org/src/lib/aframe-mapbox-component.min.js"></script>

<!-- save / load -->
<script src="https://github.3dstreet.org/src/json-utils.js"></script>

<!-- ocean -->
<script src="https://github.3dstreet.org/src/components/ocean-plane.js"></script>

<title>3DStreet</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="assets/ui_assets/favicon.ico">
<link rel="stylesheet" href="//github.3dstreet.org/src/viewer-styles.css">
</head>

<body>
<!-- viewer ui start -->
<div class="viewer-header-wrapper">
<button class="viewer-logo-start-editor-button" onclick="startEditor()">
<img class="viewer-logo-img" alt="3DStreet Viewer" src="./assets/3DStreet-Viewer-Start-Editor.svg">
</button>
</div>

<div class="right-fixed">
<ul class="right-menu">
<li onclick="screenshot()"> <a class="camera" href="#"> <span> Capture image as PNG </span> <img src="//github.3dstreet.org/ui_assets/camera-icon.svg"> </a></li>
<li onclick="inputStreetmix()"> <a class="load" href="#"> <span> Load Streetmix URL </span> <img src="//github.3dstreet.org/ui_assets/streetmix-logo.svg"> </a></li>
<!-- <li onclick="inputJSON()"> <a class="load" href="#"> <span> Load JSON String </span> <img src="assets/ui_assets/upload-icon.svg"> </a></li> -->
<li><a class="load"> <label for="inputfile" style="display: inherit; align-items: center; cursor: pointer"> <input type="file" id="inputfile" style="display:none" accept=".js, .json, .txt"> <span> Load JSON File </span> <img src="//github.3dstreet.org/ui_assets/upload-icon.svg"></label></a></li>
<li> <a id="custom-enter-vr-button" class="vr" href="#"> <span class="vr">Enter VR mode</span> <img src="//github.3dstreet.org/ui_assets/vr-icon.svg"> </a></li>
</ul>
</div>

<a-scene
vr-mode-ui="enterVRButton: #custom-enter-vr-button;"
vr-mode-ui-if-headset
renderer="colorManagement: true; physicallyCorrectLights: true;"
gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/versioned/decoders/1.4.3/"
inspector="url: //3dstreet.app/dist/3dstreet-editor.js"
timed-inspector="2"
notify
>
<a-assets>
<!-- you can specify a custom asset path using below syntax -->
<!-- <streetmix-assets url="./assets/"></streetmix-assets> -->
</a-assets>

<a-entity id="cameraRig" data-layer-name="Viewer" cursor-teleport="cameraRig: #cameraRig; cameraHead: #camera;" look-controls="reverseMouseDrag: true" wasd-controls="enabled: true">
<a-entity id="camera" camera="near: 1; far: 1000" position="0 1.6 0"></a-entity>
<a-entity id="leftHand" hand-controls="hand: left; handModelStyle: lowPoly; color: #ffccff" teleport-controls="cameraRig: #cameraRig; button: trigger"></a-entity>
<a-entity id="rightHand" hand-controls="hand: right; handModelStyle: lowPoly; color: #ffccff" teleport-controls="cameraRig: #cameraRig; button: trigger"></a-entity>
</a-entity>

<a-entity id="environment" data-layer-name="Environment" street-environment="preset: day;"></a-entity>

<a-entity id="street-container" data-layer-name="3D Street Layers" data-layer-show-children>
<a-entity
data-layer-name="16th Street West of SVN"
position="-96.980 0 -4.17918"
rotation="0 90 0"
id="east_street"
street="length: 150"
streetmix-loader="streetmixStreetURL: https://streetmix.net/kfarr/82/16th-st-harrison-st-sf-ca; showBuildings: true;"
></a-entity>
<a-entity
data-layer-name="16th Street East of SVN"
position="78.165 0 -4.17918"
rotation="0 90 0"
id="west_street"
street="length: 150"
streetmix-loader="streetmixStreetURL: https://streetmix.net/kfarr/82/16th-st-harrison-st-sf-ca; showBuildings: true;"
></a-entity>

<a-entity data-layer-name="16th & Harrison St Intersection" id="intersection" position="-9.917 0 -4.057">
<a-entity
intersection="dimensions: 27.5 24.384;northeastcurb: 4.572 4.572;southwestcurb: 4.572 4.572;southeastcurb: 4.572 4.572;northwestcurb: 4.572 4.572;trafficsignal: 1 1 1 1;crosswalk: 1 1 1 1"
></a-entity>
</a-entity>

<a-entity
data-layer-name="SVN North of 16th St"
position="-9.23383 0 -31.340"
rotation="0 0 0"
id="south_street"
street="length: 30"
streetmix-loader="streetmixStreetURL: https://streetmix.net/scott/31/south-van-ness-idea-short-term; showBuildings: false;"
></a-entity>

<a-entity
data-layer-name="SVN South of 16th St"
position="-9.23383 0 23.009"
rotation="0 180 0"
id="north_street"
street="length: 30"
streetmix-loader="streetmixStreetURL: https://streetmix.net/scott/31/south-van-ness-idea-short-term; showBuildings: false;"
></a-entity>

</a-entity>

<a-entity id="reference-layers" data-layer-name="Reference Layers" data-layer-show-children>


</a-entity>
</a-scene>
</body>
<script>
// only show VR button if headset connected
AFRAME.registerComponent('vr-mode-ui-if-headset', {
dependencies: ['vr-mode-ui'],
init: function () {
if (!AFRAME.utils.device.checkHeadsetConnected()) {
this.el.setAttribute('vr-mode-ui', 'enabled', false);
}
}
})

AFRAME.registerComponent('set-loader-from-hash', {
dependencies: ['streetmix-loader'],
schema: {
defaultURL: { type: 'string' }
},
init: function () {
// get hash from window
const streetURL = window.location.hash.substring(1);
if (streetURL !== undefined && streetURL.length > 0) {
console.log('[set-loader-from-hash]','Using URL from hash', streetURL)
this.el.setAttribute('streetmix-loader', 'streetmixStreetURL', streetURL);
}
// else {
// console.log('[set-loader-from-hash]','Using default URL', this.data.defaultURL)
// this.el.setAttribute('streetmix-loader', 'streetmixStreetURL', this.data.defaultURL);
// }
}
});

function screenshot() {
AFRAME.scenes[0].setAttribute('screenshot','width',AFRAME.scenes[0].canvas.width)
AFRAME.scenes[0].setAttribute('screenshot','height',AFRAME.scenes[0].canvas.height)
document.querySelector('a-scene').components.screenshot.capture('perspective');
}

function startEditor() {
var sceneEl = document.querySelector('a-scene');
sceneEl.components.inspector.openInspector();
document.querySelector('.viewer-header-wrapper').style.display = 'none';
}

AFRAME.registerComponent('timed-inspector', {
init: function() {
setTimeout( function () {
window.postMessage('INJECT_AFRAME_INSPECTOR')
}, this.data * 1000)
}
});

function inputStreetmix() {
streetmixURL = prompt("Please enter a Streetmix URL", "https://streetmix.net/kfarr/3/example-street");
setTimeout(function() { window.location.hash = streetmixURL; });
streetContainerEl = document.getElementById('street-container');
while (streetContainerEl.firstChild) {
streetContainerEl.removeChild(streetContainerEl.lastChild);
}
streetContainerEl.innerHTML = '<a-entity street streetmix-loader="streetmixStreetURL: '+streetmixURL+'""></a-entity>';
}

// JSON loading starts here
function getValidJSON(stringJSON) {
// Preserve newlines, etc. - use valid JSON
// Remove non-printable and other non-valid JSON characters
return stringJSON.replace(/\'/g, "")
.replace(/\n/g, "")
.replace(/[\u0000-\u0019]+/g,"");
}

function createElementsFromJSON(streetJSONString) {
const validJSONString = getValidJSON(streetJSONString);
streetContainerEl = document.getElementById('street-container');
while (streetContainerEl.firstChild) {
streetContainerEl.removeChild(streetContainerEl.lastChild);
}
var streetObject = JSON.parse(validJSONString);
createEntities(streetObject.data, streetContainerEl);
}

function inputJSON() {
const stringJSON = prompt("Please paste 3DStreet JSON string");
if (stringJSON) {
createElementsFromJSON(stringJSON);
}
}

function fileJSON() {
let reader=new FileReader();
reader.onload=function(){
createElementsFromJSON(reader.result);
}
reader.readAsText(this.files[0]);
}

document.getElementById('inputfile')
.addEventListener('change', fileJSON);
</script>
<!-- <script src="./dist/3dstreet-editor.js"></script> -->

<!-- Google Analytics - Global site tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-T65XPDLZ3F"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-T65XPDLZ3F');

gtag('event', 'ga_init');
</script>
</html>
Loading

0 comments on commit 61d4089

Please sign in to comment.