Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Priyanka
ARNishat
Commits
e9b0d83f
Commit
e9b0d83f
authored
Jun 19, 2023
by
Priyanka
Browse files
Update 1-Cube.html
parent
95fade76
Pipeline
#7863
passed with stage
in 5 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
public/1-Cube.html
View file @
e9b0d83f
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
>
content=
"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
>
<title>
Cub
e Demo
</title>
<title>
Spher
e Demo
</title>
<!-- three.js -->
<!-- three.js -->
<script
src=
"https://unpkg.com/three@0.126.0/build/three.js"
></script>
<script
src=
"https://unpkg.com/three@0.126.0/build/three.js"
></script>
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<!-- Starting an immersive WebXR session requires user interaction.
<!-- Starting an immersive WebXR session requires user interaction.
We start this one with a simple button. -->
We start this one with a simple button. -->
<button
onclick=
"activateXR()"
>
Start
Cub
e Demo
</button>
<button
onclick=
"activateXR()"
>
Start
Spher
e Demo
</button>
<script>
<script>
async
function
activateXR
()
{
async
function
activateXR
()
{
// Add a canvas element and initialize a WebGL context that is compatible with WebXR.
// Add a canvas element and initialize a WebGL context that is compatible with WebXR.
...
@@ -25,18 +25,18 @@ async function activateXR() {
...
@@ -25,18 +25,18 @@ async function activateXR() {
// The cube will have a different color on each side.
// The cube will have a different color on each side.
const
materials
=
[
const
materials
=
[
new
THREE
.
MeshBasicMaterial
({
color
:
0x
ff0000
})
,
new
THREE
.
MeshBasicMaterial
({
color
:
0x
FF00FF
})
new
THREE
.
MeshBasicMaterial
({
color
:
0x
0000ff
}),
//
new THREE.MeshBasicMaterial({color: 0x
FF00FF
}),
new
THREE
.
MeshBasicMaterial
({
color
:
0x
00ff00
}),
//
new THREE.MeshBasicMaterial({color: 0x
FF00FF
}),
new
THREE
.
MeshBasicMaterial
({
color
:
0xff00ff
}),
//
new THREE.MeshBasicMaterial({color: 0xff00ff}),
new
THREE
.
MeshBasicMaterial
({
color
:
0x00ffff
}),
//
new THREE.MeshBasicMaterial({color: 0x00ffff}),
new
THREE
.
MeshBasicMaterial
({
color
:
0xffff00
})
//
new THREE.MeshBasicMaterial({color: 0xffff00})
];
];
// Create the cube and add it to the demo scene.
// Create the cube and add it to the demo scene.
const
cub
e
=
new
THREE
.
Mesh
(
new
THREE
.
BoxBuff
erGeometry
(
0.
5
,
0.5
,
0.5
),
materials
);
const
spher
e
=
new
THREE
.
Mesh
(
new
THREE
.
Sph
er
e
Geometry
(
1
5
,
32
,
16
),
materials
);
cube
.
position
.
set
(
0
,
0
,
-
1
);
cube
.
position
.
set
(
0
,
0
,
-
1
);
scene
.
add
(
cub
e
);
scene
.
add
(
spher
e
);
// 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
({
...
...
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