Skip to content

Commit

Permalink
Update rhino3dm js userstrings example
Browse files Browse the repository at this point in the history
  • Loading branch information
fraguada committed Nov 7, 2023
1 parent 21441b7 commit 630bcd7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
4 changes: 1 addition & 3 deletions rhino3dm/cs/SampleCSAzureAppService/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection.Metadata.Ecma335;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Rhino;

Expand All @@ -16,7 +15,6 @@ public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
_logger.LogInformation("Let's Gooo!");
Random rnd = new Random();
CircumferenceString = "?";
}

Expand Down
2 changes: 1 addition & 1 deletion rhino3dm/js/SampleUserStrings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/examples/jsm/controls/OrbitControls": "https://unpkg.com/[email protected]/examples/jsm/controls/OrbitControls.js",
"three/examples/jsm/loaders/3DMLoader": "https://unpkg.com/[email protected]/examples/jsm/loaders/3DMLoader.js",
"rhino3dm":"https://unpkg.com/[email protected]beta2/rhino3dm.module.min.js"
"rhino3dm":"https://unpkg.com/[email protected]beta3/rhino3dm.module.min.js"
}
}
</script>
Expand Down
11 changes: 2 additions & 9 deletions rhino3dm/js/SampleUserStrings/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import { Rhino3dmLoader } from 'three/examples/jsm/loaders/3DMLoader'
import rhino3dm from 'rhino3dm'

const model = 'RectifiedArchimedeanSolids.3dm'
let rotation = 0.01
let rotation = 0.001
const selectMaterial = new THREE.MeshStandardMaterial( { metalness: 1, roughness: 0.7, color: 0xffff00 } )
const material = new THREE.MeshStandardMaterial( { metalness: 1, roughness: 0.7, color: 0xadd8e6 } )

window.addEventListener( 'click', handleInteraction, false)
window.addEventListener( 'mousemove', handleInteraction, false)
window.addEventListener( 'touchstart', handleInteraction, false)

// globals
Expand All @@ -22,7 +21,6 @@ const rhino = await rhino3dm()
init()
load()


async function load() {

const res = await fetch(model)
Expand Down Expand Up @@ -61,7 +59,7 @@ async function load() {

// load and pass to threejs
const loader = new Rhino3dmLoader()
loader.setLibraryPath( 'https://unpkg.com/[email protected]beta2/' )
loader.setLibraryPath( 'https://unpkg.com/[email protected]beta3/' )

loader.load( model, function ( object ) {

Expand Down Expand Up @@ -133,14 +131,9 @@ function handleInteraction( event ) {
if ( event.type === 'click' ) {
coordinates = { x: event.clientX, y: event.clientY }
}
else if ( event.type === 'mousemove' ) {
rotation = Math.abs( 1 - ( event.clientX / ( window.innerWidth / 2 ) ) ) / 10
return
}
} else if ( event instanceof TouchEvent ) {
if ( event.type === 'touchstart' ) {
coordinates = { x: event.changedTouches[0].clientX, y: event.changedTouches[0].clientY }
rotation = Math.abs( 1 - ( event.changedTouches[0].clientX / ( window.innerWidth / 2 ) ) ) / 10
}
}
onClick( coordinates )
Expand Down

0 comments on commit 630bcd7

Please sign in to comment.