env tests
This commit is contained in:
@@ -47,15 +47,18 @@
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
<video class="d-none" src="/asset/default/44.mp4" ref="videoPlayer"></video>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { GameEngine } from '@/lib/GameEngine';
|
||||
import { Hero } from '@/lib/Hero';
|
||||
import { Game1 } from '@/lib/mini-games/Game1';
|
||||
import { Game2 } from '@/lib/mini-games/Game2';
|
||||
import { Game4 } from '@/lib/mini-games/Game4';
|
||||
import { Game1 } from '@/lib/interactive-objects/Game1';
|
||||
import { Game2 } from '@/lib/interactive-objects/Game2';
|
||||
import { Game4 } from '@/lib/interactive-objects/Game4';
|
||||
import { Grass } from '@/lib/interactive-objects/Grass';
|
||||
import { VideoPlayer } from '@/lib/interactive-objects/VideoPlayer';
|
||||
import { useAppStore } from '@/stores/app';
|
||||
|
||||
const store = useAppStore();
|
||||
@@ -154,7 +157,7 @@ export default {
|
||||
}
|
||||
},
|
||||
async loadEnvironment(scene, target){
|
||||
//await gameEngine.loadPanorama(`/asset/default/43.webp`);
|
||||
await gameEngine.loadPanorama(`/asset/default/55/panorama-vaya.webp`);
|
||||
await this.expandScenarioData(scene);
|
||||
//gameEngine.activeObjects.scale.set(0.033, 0.033, 0.033)
|
||||
gameEngine.activeObjects.clear();
|
||||
@@ -166,6 +169,18 @@ export default {
|
||||
let env = await gameEngine.load(`/asset/default/${this.scene.data.$environment.asset.name}`);
|
||||
this.setObjectAttributes(l, this.scene.data, env, 100);
|
||||
gameEngine.activeObjects.add(env.scene);
|
||||
gameEngine.scene.environmentRotation.y = Math.PI / 8;
|
||||
// if (env.scene.children[0]?.material?.map){
|
||||
// let emap = env.scene.children[0].material.map.clone()
|
||||
// emap = new gameEngine.$.Texture(emap.source.data, gameEngine.$.EquirectangularReflectionMapping)
|
||||
// emap.mapping = gameEngine.$.EquirectangularReflectionMapping;
|
||||
// emap.needsUpdate = true;
|
||||
// emap.updateMatrix()
|
||||
// emap.repeat.set(-1,-1)
|
||||
// gameEngine.scene.environment = gameEngine.scene.background = emap
|
||||
// console.log('env',emap)
|
||||
// gameEngine.scene.environmentRotation.y = Math.PI / 2;
|
||||
// }
|
||||
}
|
||||
for (let i of this.scene.data.items || []) {
|
||||
let gltf = await gameEngine.load(`/asset/default/${i.data.$go.asset.name}`);
|
||||
@@ -174,6 +189,10 @@ export default {
|
||||
if (i.data.$go.type == 'player3d'){
|
||||
let hero = new Hero(gltf, i.data.$go);
|
||||
hero.init(gameEngine);
|
||||
}else{
|
||||
if (gltf.animations?.length){
|
||||
gameEngine.playAnimation(gameEngine.scene, gltf.animations[0]);
|
||||
}
|
||||
}
|
||||
//console.log(JSON.stringify(l));
|
||||
//window.gameEngine = gameEngine;
|
||||
@@ -187,15 +206,36 @@ export default {
|
||||
|
||||
let testGame1 = new Game1(gameEngine, '/static/textures/game1-test.jpg', 2, 3);
|
||||
gameEngine.activeObjects.add(testGame1.game);
|
||||
testGame1.game.position.set(0, 1, -5);
|
||||
testGame1.game.position.set(0, 1, -15);
|
||||
|
||||
let testGame2 = new Game2(gameEngine, '/static/textures/game2-test.jpg', 3, 3);
|
||||
gameEngine.activeObjects.add(testGame2.game);
|
||||
testGame2.game.position.set(0, 1, 5);
|
||||
testGame2.game.position.set(0, 1, 15);
|
||||
testGame2.game.rotation.y += Math.PI;
|
||||
|
||||
let testGame4 = new Game4(gameEngine, '/static/feathers-game.glb', 3, 4);
|
||||
gameEngine.activeObjects.add(testGame4.game);
|
||||
testGame4.game.position.set(0, 1, 5);
|
||||
testGame4.game.position.set(15, 1, 5);
|
||||
|
||||
let vp = new VideoPlayer(gameEngine, this.$refs.videoPlayer, 16, 9);
|
||||
gameEngine.activeObjects.add(vp.videoPlayer);
|
||||
vp.videoPlayer.position.set(37, 5.5, 15);
|
||||
vp.videoPlayer.rotation.y += -Math.PI/2;
|
||||
|
||||
new Grass(Grass.positions(1000,50,50), '/static/textures/grass01.png', 1, .5).then(mesh=>{
|
||||
console.log('adding grass')
|
||||
gameEngine.scene.add(mesh);
|
||||
})
|
||||
|
||||
new Grass(Grass.positions(250,50,50), '/static/textures/flowers01.png', 1, .75).then(mesh=>{
|
||||
gameEngine.scene.add(mesh);
|
||||
console.log('adding grass')
|
||||
})
|
||||
|
||||
new Grass(Grass.positions(250,50,50), '/static/textures/flowers02.png', 1, .75).then(mesh=>{
|
||||
gameEngine.scene.add(mesh);
|
||||
console.log('adding grass')
|
||||
})
|
||||
},
|
||||
async expandScenarioData(scene){
|
||||
scene.data.$environment = (await this.$api.gameObject.load(scene.data.environment)).data
|
||||
|
||||
Reference in New Issue
Block a user