batlight
This commit is contained in:
parent
fdf2adf3c9
commit
d90c41565e
@ -74,6 +74,23 @@
|
|||||||
function createObject(data, name) {
|
function createObject(data, name) {
|
||||||
const objectConstructors = {
|
const objectConstructors = {
|
||||||
"empty": data => new THREE.Object3D(),
|
"empty": data => new THREE.Object3D(),
|
||||||
|
"OBJ": data => {
|
||||||
|
let empty = new THREE.Object3D();
|
||||||
|
let loader = new OBJLoader();
|
||||||
|
loader.load(
|
||||||
|
data.url,
|
||||||
|
result => {
|
||||||
|
result.traverse(element => {
|
||||||
|
if (element instanceof THREE.Mesh) {
|
||||||
|
element.material = materials[data.material];
|
||||||
|
if (data.castShadow) element.castShadow = data.castShadow;
|
||||||
|
if (data.receiveShadow) element.receiveShadow = data.receiveShadow;
|
||||||
|
empty.add(element);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
return empty;
|
||||||
|
},
|
||||||
"Mesh": data => new THREE.Mesh(geometries[data.geometry], materials[data.material]),
|
"Mesh": data => new THREE.Mesh(geometries[data.geometry], materials[data.material]),
|
||||||
"LineSegments": data => new THREE.LineSegments(geometries[data.geometry], materials[data.material]),
|
"LineSegments": data => new THREE.LineSegments(geometries[data.geometry], materials[data.material]),
|
||||||
|
|
||||||
@ -85,7 +102,7 @@
|
|||||||
},
|
},
|
||||||
"SpotLight": data => {
|
"SpotLight": data => {
|
||||||
let object = new THREE.SpotLight(data.color ? data.color : 0xffffff, data.intensity ? data.intensity : 1);
|
let object = new THREE.SpotLight(data.color ? data.color : 0xffffff, data.intensity ? data.intensity : 1);
|
||||||
object.angle = data.angle ? data.angle : 45;
|
object.angle = THREE.MathUtils.degToRad(data.angle ? data.angle : 45);
|
||||||
if (data.position) object.position.set(...data.position);
|
if (data.position) object.position.set(...data.position);
|
||||||
object.target = objects[data.target];
|
object.target = objects[data.target];
|
||||||
object.distance = data.distance ? data.distance : 100;
|
object.distance = data.distance ? data.distance : 100;
|
||||||
|
3801
batman.obj
Normal file
3801
batman.obj
Normal file
File diff suppressed because it is too large
Load Diff
55
scene.json
55
scene.json
@ -141,6 +141,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"objects": {
|
"objects": {
|
||||||
|
"batman_logo": {
|
||||||
|
"type": "OBJ",
|
||||||
|
"url": "batman.obj",
|
||||||
|
"material": "black",
|
||||||
|
"position": [
|
||||||
|
0,
|
||||||
|
50,
|
||||||
|
50
|
||||||
|
],
|
||||||
|
"scale": [
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
10
|
||||||
|
],
|
||||||
|
"castShadow": true
|
||||||
|
},
|
||||||
"batman": {
|
"batman": {
|
||||||
"children": {
|
"children": {
|
||||||
"hip": {
|
"hip": {
|
||||||
@ -610,20 +626,49 @@
|
|||||||
"type": "AmbientLight",
|
"type": "AmbientLight",
|
||||||
"intensity": 0.3
|
"intensity": 0.3
|
||||||
},
|
},
|
||||||
"top_light": {
|
"right_pointlight": {
|
||||||
"type": "PointLight",
|
"type": "PointLight",
|
||||||
"position": [
|
"position": [
|
||||||
20,
|
20,
|
||||||
50,
|
10,
|
||||||
-30
|
-30
|
||||||
],
|
],
|
||||||
"castShadow": true,
|
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"intensity": 10000
|
"intensity": 10000
|
||||||
},
|
},
|
||||||
"top_light_helper": {
|
"right_pointlight_helper": {
|
||||||
"type": "PointLightHelper",
|
"type": "PointLightHelper",
|
||||||
"target": "top_light"
|
"target": "right_pointlight"
|
||||||
|
},
|
||||||
|
"left_pointlight": {
|
||||||
|
"type": "PointLight",
|
||||||
|
"position": [
|
||||||
|
-20,
|
||||||
|
10,
|
||||||
|
-30
|
||||||
|
],
|
||||||
|
"color": "darkblue",
|
||||||
|
"intensity": 10000
|
||||||
|
},
|
||||||
|
"left_pointlight_helper": {
|
||||||
|
"type": "PointLightHelper",
|
||||||
|
"target": "left_pointlight"
|
||||||
|
},
|
||||||
|
"batlight": {
|
||||||
|
"type": "SpotLight",
|
||||||
|
"position": [
|
||||||
|
0,
|
||||||
|
80,
|
||||||
|
50
|
||||||
|
],
|
||||||
|
"angle": 20,
|
||||||
|
"intensity": 10000000,
|
||||||
|
"castShadow": true,
|
||||||
|
"target": "batman_logo"
|
||||||
|
},
|
||||||
|
"batlight_helper": {
|
||||||
|
"type": "SpotLightHelper",
|
||||||
|
"target": "batlight"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user