Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Esguerra Montana
Web AR
Commits
dd633943
Commit
dd633943
authored
1 year ago
by
Esguerra Montana
Browse files
Options
Download
Email Patches
Plain Diff
Update index.html
parent
683808ff
master
Pipeline
#9437
passed with stage
in 9 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/index.html
+30
-3
public/index.html
with
30 additions
and
3 deletions
+30
-3
public/index.html
+
30
-
3
View file @
dd633943
...
@@ -31,6 +31,32 @@ async function activateXR() {
...
@@ -31,6 +31,32 @@ async function activateXR() {
const
ambientLight
=
new
THREE
.
AmbientLight
(
0x404040
);
// soft white light
const
ambientLight
=
new
THREE
.
AmbientLight
(
0x404040
);
// soft white light
scene
.
add
(
ambientLight
);
scene
.
add
(
ambientLight
);
// Create the torus geometry
const
torusRadius
=
1
;
const
torusTube
=
0.4
;
const
torusSegments
=
64
;
const
torusGeometry
=
new
THREE
.
TorusGeometry
(
torusRadius
,
torusTube
,
torusSegments
,
torusSegments
);
// Create a metallic gold material
const
goldMaterial
=
new
THREE
.
MeshPhysicalMaterial
({
color
:
0xFFD700
,
// Gold color
metalness
:
1.0
,
// Fully metallic
roughness
:
0.4
,
// Adjust for shininess
clearcoat
:
0.2
,
// Add clear coat for a polished effect
clearcoatRoughness
:
0.1
});
// Create the torus mesh
const
torusMesh
=
new
THREE
.
Mesh
(
torusGeometry
,
goldMaterial
);
// Add the torus mesh to the scene
scene
.
add
(
torusMesh
);
// Color of the tetrahedron geometry.
// Color of the tetrahedron geometry.
//const material = new THREE.MeshPhysicalMaterial({ color: 0xC70039, roughness: 0.5, metalness: 0.5, clearcoat: 1.0, clearcoatRoughness: 0.1 });
//const material = new THREE.MeshPhysicalMaterial({ color: 0xC70039, roughness: 0.5, metalness: 0.5, clearcoat: 1.0, clearcoatRoughness: 0.1 });
...
@@ -43,6 +69,7 @@ async function activateXR() {
...
@@ -43,6 +69,7 @@ async function activateXR() {
// Add the mesh to the scene
// Add the mesh to the scene
//scene.add(tetrahedron);
//scene.add(tetrahedron);
/*
// Define the vertices
// Define the vertices
var vertices = new Float32Array([
var vertices = new Float32Array([
-1.0, 0.0, 1.0, // P0
-1.0, 0.0, 1.0, // P0
...
@@ -98,7 +125,7 @@ async function activateXR() {
...
@@ -98,7 +125,7 @@ async function activateXR() {
// Add the meshes to the scene
// Add the meshes to the scene
scene.add(wallMesh);
scene.add(wallMesh);
scene
.
add
(
roofMesh
);
scene.add(roofMesh);
*/
// Set up the WebGLRenderer, which handles rendering to the session's base layer.
// Set up the WebGLRenderer, which handles rendering to the session's base layer.
const
renderer
=
new
THREE
.
WebGLRenderer
({
const
renderer
=
new
THREE
.
WebGLRenderer
({
...
@@ -148,9 +175,9 @@ async function activateXR() {
...
@@ -148,9 +175,9 @@ async function activateXR() {
camera
.
projectionMatrix
.
fromArray
(
view
.
projectionMatrix
);
camera
.
projectionMatrix
.
fromArray
(
view
.
projectionMatrix
);
camera
.
updateMatrixWorld
(
true
);
camera
.
updateMatrixWorld
(
true
);
// Rotate the house
/*
// Rotate the house
wallMesh.rotation.y += 0.01;
wallMesh.rotation.y += 0.01;
roofMesh
.
rotation
.
y
+=
0.01
;
roofMesh.rotation.y += 0.01;
*/
// Render the scene with THREE.WebGLRenderer.
// Render the scene with THREE.WebGLRenderer.
renderer
.
render
(
scene
,
camera
);
renderer
.
render
(
scene
,
camera
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets