Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Extensions/3D/DirectionalLight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,40 @@ namespace gdjs {
if (!scene) {
return false;
}
const skyboxGeo = new THREE.BoxGeometry(10000, 10000, 10000);

const ft = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_north.png'
);
const bk = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_south.png'
);
const up = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_up.png'
);
const dn = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_down.png'
);
const rt = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_east.png'
);
const lf = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_west.png'
);

const materialArray = [
new THREE.MeshBasicMaterial({ map: rt, side: THREE.BackSide }), // Right
new THREE.MeshBasicMaterial({ map: up, side: THREE.BackSide }), // Left
new THREE.MeshBasicMaterial({ map: lf, side: THREE.BackSide }), // Top
new THREE.MeshBasicMaterial({ map: dn, side: THREE.BackSide }), // Bottom
new THREE.MeshBasicMaterial({ map: bk, side: THREE.BackSide }), // Front
new THREE.MeshBasicMaterial({ map: ft, side: THREE.BackSide }), // Back
];
const skybox = new THREE.Mesh(skyboxGeo, materialArray);
skybox.position.set(0, 0, 0);
skybox.frustumCulled = false;

scene.add(skybox);
scene.add(this._light);
scene.add(this._light.target);
if (this._shadowCameraHelper) {
Expand Down
Binary file added Extensions/3D/clouds1_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Extensions/3D/clouds1_east.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Extensions/3D/clouds1_north.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Extensions/3D/clouds1_south.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Extensions/3D/clouds1_up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Extensions/3D/clouds1_west.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions GDJS/Runtime/pixi-renderers/runtimescene-pixi-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace gdjs {
private _profilerText: PIXI.Text | null = null;
private _showCursorAtNextRender: boolean = false;
private _threeRenderer: THREE.WebGLRenderer | null = null;
private loader: THREE.CubeTextureLoader;
private texture: THREE.CubeTexture;
private _layerRenderingMetrics: {
rendered2DLayersCount: number;
rendered3DLayersCount: number;
Expand All @@ -33,6 +35,17 @@ namespace gdjs {
this._threeRenderer = this._runtimeGameRenderer
? this._runtimeGameRenderer.getThreeRenderer()
: null;

this.loader = new THREE.CubeTextureLoader();

this.texture = this.loader.load([
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_east.png', // px
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_west.png', // nx
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_up.png', // py
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_down.png', // ny
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_north.png', // pz
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_south.png', // nz
]);
}

onGameResolutionResized() {
Expand Down Expand Up @@ -209,9 +222,11 @@ namespace gdjs {
);
threeRenderer.resetState();
if (this._runtimeScene.getClearCanvas()) threeRenderer.clear();
threeScene.background = new THREE.Color(
this._runtimeScene.getBackgroundColor()
);

threeScene.background = this.texture;
// threeScene.background = new THREE.Color(
// this._runtimeScene.getBackgroundColor()
// );

isFirstRender = false;
} else {
Expand Down