test ground
This commit is contained in:
parent
667b2dbcbd
commit
36a6c3e690
|
@ -131,6 +131,7 @@ const loadModels = async () => {
|
||||||
addTexture = await useTexture(tex)
|
addTexture = await useTexture(tex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!models.value.find(el => el.name == 'ground')) {
|
||||||
const mesh = {
|
const mesh = {
|
||||||
color: c.offsetHSL(0, 0.5, -0.33),
|
color: c.offsetHSL(0, 0.5, -0.33),
|
||||||
displacementScale: envVars.focus * 0.33,
|
displacementScale: envVars.focus * 0.33,
|
||||||
|
@ -153,6 +154,7 @@ const loadModels = async () => {
|
||||||
ground.rotateX(-Math.PI / 2)
|
ground.rotateX(-Math.PI / 2)
|
||||||
ground.name = "ground"
|
ground.name = "ground"
|
||||||
models.value.push({ name: 'ground', modelFile: ground })
|
models.value.push({ name: 'ground', modelFile: ground })
|
||||||
|
}
|
||||||
|
|
||||||
for (let index = 0; index < clickable.list.length; index++) {
|
for (let index = 0; index < clickable.list.length; index++) {
|
||||||
const element = clickable.list[index];
|
const element = clickable.list[index];
|
||||||
|
@ -185,18 +187,19 @@ const loadModels = async () => {
|
||||||
sidebar_scene.name = raw_data.name;
|
sidebar_scene.name = raw_data.name;
|
||||||
sidebar_scene.setData(sidebar_items)
|
sidebar_scene.setData(sidebar_items)
|
||||||
|
|
||||||
const loaded = seekByName(scene.value, 'loaded')
|
|
||||||
if (loaded) {
|
|
||||||
const box = new Box3();
|
const box = new Box3();
|
||||||
box.expandByObject(loaded);
|
models.value.forEach(element => {
|
||||||
|
if (element.name !== 'ground') {
|
||||||
|
box.expandByObject(element.modelFile.clone());
|
||||||
|
}
|
||||||
|
});
|
||||||
const box_size = new Vector3();
|
const box_size = new Vector3();
|
||||||
box.getSize(box_size)
|
box.getSize(box_size)
|
||||||
props.loaded_pan(
|
props.loaded_pan(
|
||||||
new Vector3(box_size.x * 0.5, box_size.y * 0.5, box_size.z * 0.5),
|
new Vector3(box_size.x * 0.5, box_size.y * 0.5, box_size.z * 0.5),
|
||||||
new Vector3(box_size.x * -0.5, box_size.y * -0.25, box_size.z * -0.5),
|
new Vector3(box_size.x * -0.5, box_size.y * -0.25, box_size.z * -0.5),
|
||||||
)
|
)
|
||||||
}
|
console.log(box_size)
|
||||||
|
|
||||||
controls.value.enabled = true;
|
controls.value.enabled = true;
|
||||||
props.loaded(false)
|
props.loaded(false)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue