Skip to content

Commit

Permalink
show torus color and rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Eole211 committed Apr 9, 2019
1 parent f3ad214 commit e3fba70
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
2 changes: 2 additions & 0 deletions src/modules/torus/src/torus.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const Torus = {
});

Torus.mesh = torus;
torus.rotationQuaternion = BABYLON.Quaternion.Identity();
self.app.events.emit("ready");
},


Expand Down
33 changes: 23 additions & 10 deletions src/modules/torus/src/torus.vue
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
<template>
<div v-if="color">Rouge : {{color.r}}</div>
<div id="torus">
<div v-if="color">Rouge : {{color.r}}</div>
<br>
<div v-if="rotation" >
Rotation :
<br>x: {{round3(rotationEuler.x)}}
<br>y: {{round3(rotationEuler.y)}}
<br>z: {{round3(rotationEuler.z)}}
</div>
</div>
</template>

<script>
import Torus from "./torus";
import self from "../index";
export default {
name: 'torus-infos',
watch: {
material(val) {
this.color = val.diffuseColor;
}
mounted(){
self.app.events.on("ready",()=>{
this.color = Torus.mesh.material.diffuseColor;
this.rotation = Torus.mesh.rotationQuaternion;
})
},
data(){
return {
torus: Torus,
color : null
color : null,
rotation : null
}
},
computed:{
material(){
return Torus.mesh? Torus.mesh.material: null;
rotationEuler(){
return this.rotation ? this.rotation.toEulerAngles() : null;
}
},
components: {},
methods: {
round3(num){
return Math.round(num*1000)/1000;
}
}
}
</script>
7 changes: 1 addition & 6 deletions src/modules/vuejs/src/templates/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@ export default {
"main-canvas": MainCanvas
},
created: function(){
console.log("COUCOU c'est moi l'app", this.meshManager);
console.log("Hey, it's me, the main vue for your Obsidian app", this.meshManager);
},
methods: {
onClick() {
}
}
}
</script>

Expand Down

0 comments on commit e3fba70

Please sign in to comment.