This commit is contained in:
Tony Garnock-Jones 2023-01-10 16:36:03 +01:00
parent e92e656928
commit fba65e3ec0
20 changed files with 44 additions and 9 deletions

View File

@ -2,7 +2,7 @@ version 1 .
Sprite = <sprite @name string @shape Shape> .
Shape = Mesh / Light / Scale / Move / Rotate / @many [Shape ...] / Texture / Color / Name / Floor / Nonphysical / Touchable / CSG .
Shape = Mesh / Light / Scale / Move / Rotate / @many [Shape ...] / Texture / Color / Name / Floor / Nonphysical / Touchable / CSG / Skybox .
Mesh = Sphere / Box / Ground / Plane .
@ -48,3 +48,5 @@ CSGExpr =
/ <intersect @shapes [CSGExpr ...]>
/ <invert @shape CSGExpr>
.
Skybox = <skybox @path string> .

View File

@ -1,5 +1,6 @@
<sprite "light" <hemispheric-light <v 0.1 1.0 0.0>>>
<gravity <v 0.0 -9.81 0.0>>
<sprite "sky" <skybox "textures/Daylight Box UV_0">>
<sprite "ground"
<texture ["textures/grass-256x256.jpg"
@ -24,7 +25,7 @@
<Exit "p" "lobby">
<sprite "p"
<move <v -1000.0 2.0 3.0>
<move <v -999.5 2.0 3.0>
<rotate <v 0.0 -0.25 0.0>
<color 1.0 0.0 1.0
<touchable <scale <v 1.0 2.0 1.0> <plane>>>>>>>

View File

@ -1,13 +1,14 @@
<sprite "light" <hemispheric-light <v 0.1 1.0 0.0>>>
<gravity <v 0.0 -9.81 0.0>>
;<gravity <v 0.0 -9.81 0.0>>
<sprite "sky" <skybox "textures/eso0932a">>
<sprite "ground2"
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
<v 100.0 100.0>
<v 0.0 0.0>]
<floor <ground <v 300.0 300.0>>>>>
; <sprite "ground2"
; <texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
; <v 100.0 100.0>
; <v 0.0 0.0>]
; <floor <ground <v 300.0 300.0>>>>>
<Exit "home" "lobby" <v -2.5 1.6 0.5>>
<Exit "home" "lobby" <v -2.5 0.0 0.5>>
<sprite "home"
<move <v 0.0 0.0 -2.0>
<rotate <v 0.0 -0.5 0.0> [

View File

@ -1,5 +1,6 @@
import {
Color3,
CubeTexture,
CSG,
HemisphericLight,
Material,
@ -309,6 +310,19 @@ export function build(name: string, scene: Scene, shape: Shapes.Shape, customize
throw new Error("unimplemented");
}
case "Skybox": {
const t = new ShapeTree<Mesh>(scene, shape, MeshBuilder.CreateBox(name, { size: 2000 }, scene));
const mat = new StandardMaterial(name, scene);
mat.backFaceCulling = false;
mat.reflectionTexture = new CubeTexture(shape.value.path, scene);
mat.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;
mat.diffuseColor = new Color3(0, 0, 0);
mat.specularColor = new Color3(0, 0, 0);
t.node.material = mat;
applyCustomizer(t, customize);
return t;
}
default:
((_shape: never) => {
console.error('Unsupported shape variant', shape);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1 +1,3 @@
door1.jpg: based on https://commons.wikimedia.org/wiki/File:Simple_door_inside_the_BCR_Headquarters_Building,_in_Bucharest_%28Romania%29.jpg, CC-SA 4.0
Daylight Box UV_0.png and extracted jpgs: from https://opengameart.org/content/sky-box-sunny-day, "Copyright/Attribution Notice: KIIRA" (?)
eso0932a.jpg: https://www.eso.org/public/images/eso0932a/

15
textures/cut_skybox.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
inputfile="$1"
if [ -z "$inputfile" ]
then
echo 'Usage: cut_skybox.sh INPUTFILENAME' >&2
exit 1
fi
convert -extract 512x512+0+512 "$inputfile" "$(basename "$(basename "$inputfile" .png)" .jpg)_nx.jpg"
convert -extract 512x512+512+512 "$inputfile" "$(basename "$(basename "$inputfile" .png)" .jpg)_pz.jpg"
convert -extract 512x512+1024+512 "$inputfile" "$(basename "$(basename "$inputfile" .png)" .jpg)_px.jpg"
convert -extract 512x512+1536+512 "$inputfile" "$(basename "$(basename "$inputfile" .png)" .jpg)_nz.jpg"
convert -extract 512x512+512+0 "$inputfile" "$(basename "$(basename "$inputfile" .png)" .jpg)_py.jpg"
convert -extract 512x512+512+1024 "$inputfile" "$(basename "$(basename "$inputfile" .png)" .jpg)_ny.jpg"

BIN
textures/eso0932a.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 MiB

BIN
textures/eso0932a_nx.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

BIN
textures/eso0932a_ny.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

BIN
textures/eso0932a_nz.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

BIN
textures/eso0932a_px.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB

BIN
textures/eso0932a_py.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

BIN
textures/eso0932a_pz.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 KiB