Skip to content

Commit cc7c6b6

Browse files
committed
add skybox opiton to background texture
1 parent 629e76d commit cc7c6b6

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

src/Threejs/assets/dist/controller.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type Material = {
77
transparent: boolean;
88
type: string;
99
doubleSide: boolean;
10+
skybox: boolean;
1011
};
1112
export type Mesh = {
1213
geometry: any;

src/Threejs/assets/dist/controller.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ class default_1 extends Controller {
2020
scene.background = new THREE.Color(sceneValue.material.color);
2121
}
2222
if (sceneValue.material.map) {
23-
scene.background = new THREE.TextureLoader().load(sceneValue.material.map);
23+
const texture = new THREE.TextureLoader().load(sceneValue.material.map);
24+
if (sceneValue.material.skybox)
25+
texture.mapping = THREE.EquirectangularReflectionMapping;
26+
scene.background = texture;
2427
}
2528
const cameras = [];
2629
for (let cameraData of rendererValue.cameras) {

src/Threejs/assets/src/controller.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type Material = {
1010
transparent: boolean;
1111
type: string;
1212
doubleSide: boolean;
13+
skybox: boolean;
1314
}
1415

1516
export type Mesh = {
@@ -61,12 +62,18 @@ export default class extends Controller {
6162
let scene = new THREE.Scene();
6263
const light = new THREE.AmbientLight(0x404040); // Lumière ambiante
6364
scene.add(light);
65+
6466
if (sceneValue.material.color) {
6567
scene.background = new THREE.Color(sceneValue.material.color);
6668
}
6769
if (sceneValue.material.map) {
68-
scene.background = new THREE.TextureLoader().load(sceneValue.material.map);
69-
}
70+
const texture = new THREE.TextureLoader().load(sceneValue.material.map);
71+
if(sceneValue.material.skybox)
72+
texture.mapping = THREE.EquirectangularReflectionMapping;
73+
scene.background = texture;
74+
75+
}
76+
7077

7178
/** cameras */
7279
const cameras: THREE.Camera[] = [];

src/Threejs/composer.json

+8-10
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,18 @@
2828
}
2929
},
3030
"require": {
31-
"php": ">=8.1",
32-
"symfony/config": "^5.4|^6.0|^7.0",
33-
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
34-
"symfony/http-kernel": "^5.4|^6.0|^7.0",
35-
"symfony/stimulus-bundle": "^2.9.1"
31+
"php": ">=8.3",
32+
"symfony/stimulus-bundle": "^2.18.1"
3633
},
3734
"require-dev": {
38-
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
39-
"symfony/phpunit-bridge": "^5.4|^6.0|^7.0",
40-
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
41-
"symfony/var-dumper": "^5.4|^6.0|^7.0"
35+
"symfony/asset-mapper": "^6.4|^7.0",
36+
"symfony/framework-bundle": "^6.4|^7.0",
37+
"symfony/phpunit-bridge": "^6.4|^7.0",
38+
"symfony/twig-bundle": "^6.4|^7.0",
39+
"symfony/ux-twig-component": "^2.18"
4240
},
4341
"conflict": {
44-
"symfony/flex": "<1.13"
42+
"symfony/ux-twig-component": "<2.21"
4543
},
4644
"extra": {
4745
"thanks": {

src/Threejs/src/Material/Material.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function __construct(
2525
public float $opacity = 1,
2626
public string $map = '',
2727
public bool $doubleSide = false,
28+
public bool $skybox = false,
2829

2930
) {
3031
$this->transparent = $this->opacity < 1;

0 commit comments

Comments
 (0)