Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webgl25
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Villard PierreFrederic
webgl25
Commits
928b8a73
Commit
928b8a73
authored
4 months ago
by
Thomas KANY
Browse files
Options
Downloads
Patches
Plain Diff
sapin route
parent
0c52c9ba
Branches
main
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ALVARIZA-BILLAR_DESERT_KANY/projet.js
+40
-6
40 additions, 6 deletions
ALVARIZA-BILLAR_DESERT_KANY/projet.js
ALVARIZA-BILLAR_DESERT_KANY/textures/beton.jpg
+0
-0
0 additions, 0 deletions
ALVARIZA-BILLAR_DESERT_KANY/textures/beton.jpg
with
40 additions
and
6 deletions
ALVARIZA-BILLAR_DESERT_KANY/projet.js
+
40
−
6
View file @
928b8a73
...
...
@@ -61,11 +61,24 @@ function fillScene() {
new
THREE
.
MeshLambertMaterial
({
map
:
roadTexture
})
);
road
.
rotation
.
x
=
-
Math
.
PI
/
2
;
road
.
position
.
y
=
15
;
road
.
position
.
y
=
20
;
road
.
position
.
z
=
20
;
scene
.
add
(
road
);
//Ajout du carré de beton pour la station essence
var
betonTexture
=
texture
.
load
(
'
textures/beton.jpg
'
);
var
beton
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneGeometry
(
5000
,
5000
),
new
THREE
.
MeshLambertMaterial
({
map
:
betonTexture
})
);
beton
.
rotation
.
x
=
-
Math
.
PI
/
2
;
beton
.
position
.
set
(
-
4000
,
20
,
0
);
// Positionner le carré de béton plus à droite
scene
.
add
(
beton
);
new
MTLLoader
()
.
load
(
'
tree_bonus.mtl
'
,
function
(
materials
)
{
materials
.
preload
();
...
...
@@ -74,11 +87,32 @@ function fillScene() {
.
setMaterials
(
materials
)
.
load
(
'
tree_bonus.obj
'
,
function
(
object
)
{
// Colorer l'arbre en vert sapin et enlever le reflet blanc
object
.
traverse
(
function
(
child
)
{
if
(
child
.
isMesh
)
{
child
.
material
=
new
THREE
.
MeshLambertMaterial
({
color
:
0x228B22
});
// Vert sapin
}
});
object
.
traverse
(
function
(
child
)
{
if
(
child
.
isMesh
)
{
child
.
material
=
new
THREE
.
MeshLambertMaterial
({
color
:
0x228B22
});
// Vert sapin
}
});
// Créer un rectangle de sapins à gauche de la route
var
numTreesX
=
20
;
// Nombre de sapins sur l'axe X
var
numTreesZ
=
100
;
// Nombre de sapins sur l'axe Z
var
spacingX
=
2000
;
// Espacement entre les sapins sur l'axe X
var
spacingZ
=
1000
;
// Espacement entre les sapins sur l'axe Z
var
startX
=
5000
;
// Position de départ sur l'axe X
var
startZ
=
-
50000
;
// Position de départ sur l'axe Z
// Position de départ sur l'axe Z pour déplacer les arbres plus au sud
for
(
var
x
=
0
;
x
<
numTreesX
;
x
++
)
{
for
(
var
z
=
0
;
z
<
numTreesZ
;
z
++
)
{
var
tree
=
object
.
clone
();
tree
.
position
.
set
(
startX
+
x
*
spacingX
,
0
,
startZ
+
z
*
spacingZ
);
tree
.
scale
.
setScalar
(
400
);
scene
.
add
(
tree
);
}
}
// Créer plusieurs cercles de sapins
var
numCircles
=
10
;
// Nombre de cercles
...
...
This diff is collapsed.
Click to expand it.
ALVARIZA-BILLAR_DESERT_KANY/textures/beton.jpg
0 → 100644
+
0
−
0
View file @
928b8a73
63.4 KiB
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment