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
Thapa
visualization
Commits
af6859ec
Commit
af6859ec
authored
1 year ago
by
Thapa
Browse files
Options
Download
Email Patches
Plain Diff
Update 1-Cube.html
parent
7502cbb1
master
Pipeline
#8084
passed with stage
in 6 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/1-Cube.html
+20
-23
public/1-Cube.html
with
20 additions
and
23 deletions
+20
-23
public/1-Cube.html
+
20
-
23
View file @
af6859ec
...
...
@@ -23,29 +23,26 @@ async function activateXR() {
const
scene
=
new
THREE
.
Scene
();
// The cube will have a different color on each side.
const
materials
=
[
new
THREE
.
MeshBasicMaterial
({
color
:
0x744700
}),
new
THREE
.
MeshBasicMaterial
({
color
:
0x744700
}),
new
THREE
.
MeshBasicMaterial
({
color
:
0x744700
}),
new
THREE
.
MeshBasicMaterial
({
color
:
0x744700
}),
new
THREE
.
MeshBasicMaterial
({
color
:
0x744700
}),
new
THREE
.
MeshBasicMaterial
({
color
:
0x744700
})
];
// Create the cube and add it to the demo scene.
const
cube
=
new
THREE
.
Mesh
(
new
THREE
.
BoxBufferGeometry
(
0.5
,
0.5
,
0.5
),
materials
);
cube
.
position
.
set
(
0
,
0
,
-
1
);
scene
.
add
(
cube
);
// Set up the WebGLRenderer, which handles rendering to the session's base layer.
const
renderer
=
new
THREE
.
WebGLRenderer
({
// Load the texture for the Earth globe.
const
textureLoader
=
new
THREE
.
TextureLoader
();
const
texture
=
textureLoader
.
load
(
'
earth_texture.jpg
'
);
// Create the Earth sphere and add it to the demo scene.
const
sphere
=
new
THREE
.
Mesh
(
new
THREE
.
SphereBufferGeometry
(
0.5
,
64
,
64
),
// Adjust the radius as needed.
new
THREE
.
MeshBasicMaterial
({
map
:
texture
})
// Apply the Earth texture to the sphere.
);
sphere
.
position
.
set
(
0
,
0
,
-
1
);
scene
.
add
(
sphere
);
// Set up the WebGLRenderer, which handles rendering to the session's base layer.
const
renderer
=
new
THREE
.
WebGLRenderer
({
alpha
:
true
,
preserveDrawingBuffer
:
true
,
canvas
:
canvas
,
context
:
gl
});
renderer
.
autoClear
=
false
;
});
renderer
.
autoClear
=
false
;
// The API directly updates the camera matrices.
// Disable matrix auto updates so three.js doesn't attempt
...
...
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