External objects. Not quite right, customizations aren't being applied yet
This commit is contained in:
parent
d59de6f641
commit
df1f42ea81
|
@ -0,0 +1,28 @@
|
||||||
|
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
||||||
|
# ´´½¨µÄÎļş:12.01.2012 11:15:13
|
||||||
|
|
||||||
|
newmtl Material__28
|
||||||
|
Ns 0.0000
|
||||||
|
Ni 1.5000
|
||||||
|
d 1.0000
|
||||||
|
Tr 0.0000
|
||||||
|
Tf 1.0000 1.0000 1.0000
|
||||||
|
illum 2
|
||||||
|
Ka 0.0706 0.0706 0.0706
|
||||||
|
Kd 0.0706 0.0706 0.0706
|
||||||
|
Ks 0.1800 0.1800 0.1800
|
||||||
|
Ke 0.0071 0.0071 0.0071
|
||||||
|
map_Ka maps\Fabrics.Linen.jpg
|
||||||
|
map_Kd maps\Fabrics.Linen.jpg
|
||||||
|
|
||||||
|
newmtl 02___Default
|
||||||
|
Ns 10.0000
|
||||||
|
Ni 1.5000
|
||||||
|
d 1.0000
|
||||||
|
Tr 0.0000
|
||||||
|
Tf 1.0000 1.0000 1.0000
|
||||||
|
illum 2
|
||||||
|
Ka 0.6196 0.6196 0.6196
|
||||||
|
Kd 0.6196 0.6196 0.6196
|
||||||
|
Ks 1.1465 1.1465 1.1465
|
||||||
|
Ke 0.2169 0.2169 0.2169
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -4,12 +4,13 @@ Sprite = <sprite @name string @shape Shape> .
|
||||||
|
|
||||||
Shape = Mesh / Light / Scale / Move / Rotate / @many [Shape ...] / Texture / Color / Name / Floor / Nonphysical / Touchable / CSG / Skybox .
|
Shape = Mesh / Light / Scale / Move / Rotate / @many [Shape ...] / Texture / Color / Name / Floor / Nonphysical / Touchable / CSG / Skybox .
|
||||||
|
|
||||||
Mesh = Sphere / Box / Ground / Plane .
|
Mesh = Sphere / Box / Ground / Plane / External .
|
||||||
|
|
||||||
Sphere = <sphere> .
|
Sphere = <sphere> .
|
||||||
Box = <box> .
|
Box = <box> .
|
||||||
Plane = <plane> .
|
|
||||||
Ground = <ground @size Vector2> .
|
Ground = <ground @size Vector2> .
|
||||||
|
Plane = <plane> .
|
||||||
|
External = <external @path string> .
|
||||||
|
|
||||||
Light = <hemispheric-light @v Vector3> .
|
Light = <hemispheric-light @v Vector3> .
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,11 @@
|
||||||
<color 0.5 0.5 0.0
|
<color 0.5 0.5 0.0
|
||||||
<box>>>>>>>
|
<box>>>>>>>
|
||||||
|
|
||||||
|
<sprite "sofa"
|
||||||
|
<rotate <v -0.125 0.5 0.0>
|
||||||
|
<scale <v 0.01 0.01 0.01>
|
||||||
|
<external "objects/IKE020001_obj/IKEA-Arild_2_Seat_Sofa-3D.obj">>>>
|
||||||
|
|
||||||
<sprite "x"
|
<sprite "x"
|
||||||
<move <v 10.0 1.6 -5.0>
|
<move <v 10.0 1.6 -5.0>
|
||||||
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
|
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
PhotoDome,
|
PhotoDome,
|
||||||
Quaternion,
|
Quaternion,
|
||||||
Scene,
|
Scene,
|
||||||
|
SceneLoader,
|
||||||
StandardMaterial,
|
StandardMaterial,
|
||||||
Texture,
|
Texture,
|
||||||
TransformNode,
|
TransformNode,
|
||||||
|
@ -178,7 +179,11 @@ function releaseTexture(entry: CachedTexture) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildMesh(name: string, scene: Scene | null, meshSpec: Shapes.Mesh): Mesh {
|
export function buildMesh(
|
||||||
|
name: string,
|
||||||
|
scene: Scene | null,
|
||||||
|
meshSpec: Shapes.Mesh,
|
||||||
|
): Mesh {
|
||||||
switch (meshSpec._variant) {
|
switch (meshSpec._variant) {
|
||||||
case "Sphere": return MeshBuilder.CreateSphere(name, {}, scene);
|
case "Sphere": return MeshBuilder.CreateSphere(name, {}, scene);
|
||||||
case "Box": return MeshBuilder.CreateBox(name, {}, scene);
|
case "Box": return MeshBuilder.CreateBox(name, {}, scene);
|
||||||
|
@ -187,6 +192,20 @@ export function buildMesh(name: string, scene: Scene | null, meshSpec: Shapes.Me
|
||||||
return MeshBuilder.CreateGround(name, { width: v.x, height: v.y }, scene ?? void 0);
|
return MeshBuilder.CreateGround(name, { width: v.x, height: v.y }, scene ?? void 0);
|
||||||
}
|
}
|
||||||
case "Plane": return MeshBuilder.CreatePlane(name, {}, scene);
|
case "Plane": return MeshBuilder.CreatePlane(name, {}, scene);
|
||||||
|
case "External": {
|
||||||
|
const primary = new Mesh(name, scene);
|
||||||
|
SceneLoader.ImportMesh(
|
||||||
|
"",
|
||||||
|
meshSpec.value.path,
|
||||||
|
void 0,
|
||||||
|
scene,
|
||||||
|
meshes => meshes.forEach(m => {
|
||||||
|
m.parent = primary;
|
||||||
|
console.log('adding submesh');
|
||||||
|
}));
|
||||||
|
console.log('returning primary');
|
||||||
|
return primary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,16 +344,6 @@ export function build(name: string, scene: Scene, shape: Shapes.Shape, customize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function emptyCSG(): CSG {
|
|
||||||
const c = new CSG();
|
|
||||||
c.matrix = Matrix.Identity();
|
|
||||||
c.position = Vector3.Zero();
|
|
||||||
c.rotation = Vector3.Zero();
|
|
||||||
c.scaling = Vector3.Zero();
|
|
||||||
c.rotationQuaternion = null;
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function buildCSG(expr: Shapes.CSGExpr): CSG {
|
export function buildCSG(expr: Shapes.CSGExpr): CSG {
|
||||||
function walk(expr: Shapes.CSGExpr, matrix: Matrix): CSG {
|
function walk(expr: Shapes.CSGExpr, matrix: Matrix): CSG {
|
||||||
switch (expr._variant) {
|
switch (expr._variant) {
|
||||||
|
|
Loading…
Reference in New Issue