1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00
This commit is contained in:
Kevin Levron 2021-02-26 23:46:58 +01:00
parent ca3c622fad
commit d9265d03f3
14 changed files with 88 additions and 59262 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
build/trois.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -930,7 +930,13 @@ var TubeGeometry = {
}; };
var Light = { var Light = {
inject: ['scene'], inject: {
scene: 'scene',
parent: {
from: 'group',
default: function () { return inject('scene'); },
},
},
props: { props: {
color: { color: {
type: String, type: String,
@ -949,9 +955,6 @@ var Light = {
}, },
// can't use setup because it will not be used in sub components // can't use setup because it will not be used in sub components
// setup() {}, // setup() {},
created: function created() {
this.parent = inject('group', this.scene);
},
mounted: function mounted() { mounted: function mounted() {
var this$1 = this; var this$1 = this;
@ -1456,7 +1459,15 @@ var CubeTexture = {
}; };
var Mesh = { var Mesh = {
inject: ['three', 'scene', 'rendererComponent'], inject: {
three: 'three',
scene: 'scene',
rendererComponent: 'rendererComponent',
parent: {
from: 'group',
default: function () { return inject('scene'); },
},
},
emits: ['ready'], emits: ['ready'],
props: { props: {
materialId: String, materialId: String,
@ -1470,9 +1481,6 @@ var Mesh = {
}, },
// can't use setup because it will not be used in sub components // can't use setup because it will not be used in sub components
// setup() {}, // setup() {},
created: function created() {
this.parent = inject('group', this.scene);
},
provide: function provide() { provide: function provide() {
return { return {
mesh: this, mesh: this,
@ -2206,8 +2214,9 @@ var InstancedMesh = {
castShadow: Boolean, castShadow: Boolean,
receiveShadow: Boolean, receiveShadow: Boolean,
}, },
created: function created() { setup: function setup() {
this.parent = inject('group', this.scene); var parent = inject('group', inject('scene'));
return { parent: parent };
}, },
provide: function provide() { provide: function provide() {
return { return {
@ -2346,8 +2355,9 @@ var Sprite = {
position: Object, position: Object,
scale: Object, scale: Object,
}, },
created: function created() { setup: function setup() {
this.parent = inject('group', this.scene); var parent = inject('group', inject('scene'));
return { parent: parent };
}, },
mounted: function mounted() { mounted: function mounted() {
this.texture = new TextureLoader().load(this.src, this.onLoaded); this.texture = new TextureLoader().load(this.src, this.onLoaded);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -929,7 +929,13 @@ var TubeGeometry = {
}; };
var Light = { var Light = {
inject: ['scene'], inject: {
scene: 'scene',
parent: {
from: 'group',
default: function () { return inject('scene'); },
},
},
props: { props: {
color: { color: {
type: String, type: String,
@ -948,9 +954,6 @@ var Light = {
}, },
// can't use setup because it will not be used in sub components // can't use setup because it will not be used in sub components
// setup() {}, // setup() {},
created: function created() {
this.parent = inject('group', this.scene);
},
mounted: function mounted() { mounted: function mounted() {
var this$1 = this; var this$1 = this;
@ -1455,7 +1458,15 @@ var CubeTexture = {
}; };
var Mesh = { var Mesh = {
inject: ['three', 'scene', 'rendererComponent'], inject: {
three: 'three',
scene: 'scene',
rendererComponent: 'rendererComponent',
parent: {
from: 'group',
default: function () { return inject('scene'); },
},
},
emits: ['ready'], emits: ['ready'],
props: { props: {
materialId: String, materialId: String,
@ -1469,9 +1480,6 @@ var Mesh = {
}, },
// can't use setup because it will not be used in sub components // can't use setup because it will not be used in sub components
// setup() {}, // setup() {},
created: function created() {
this.parent = inject('group', this.scene);
},
provide: function provide() { provide: function provide() {
return { return {
mesh: this, mesh: this,
@ -2205,8 +2213,9 @@ var InstancedMesh = {
castShadow: Boolean, castShadow: Boolean,
receiveShadow: Boolean, receiveShadow: Boolean,
}, },
created: function created() { setup: function setup() {
this.parent = inject('group', this.scene); var parent = inject('group', inject('scene'));
return { parent: parent };
}, },
provide: function provide() { provide: function provide() {
return { return {
@ -2345,8 +2354,9 @@ var Sprite = {
position: Object, position: Object,
scale: Object, scale: Object,
}, },
created: function created() { setup: function setup() {
this.parent = inject('group', this.scene); var parent = inject('group', inject('scene'));
return { parent: parent };
}, },
mounted: function mounted() { mounted: function mounted() {
this.texture = new TextureLoader().load(this.src, this.onLoaded); this.texture = new TextureLoader().load(this.src, this.onLoaded);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "troisjs", "name": "troisjs",
"version": "0.1.2", "version": "0.1.3",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",

View File

@ -126,41 +126,41 @@ export default [
terser(), terser(),
], ],
}, },
{ // {
input, // input,
external: [ // external: [
'gsap', // 'gsap',
'vue', // 'vue',
], // ],
output: { // output: {
format: 'cjs', // format: 'cjs',
file: 'build/trois.js', // file: 'build/trois.js',
sourcemap: true, // sourcemap: true,
}, // },
plugins: [ // plugins: [
...plugins, // ...plugins,
resolve({ // resolve({
moduleDirectories: ['node_modules'], // moduleDirectories: ['node_modules'],
}), // }),
], // ],
}, // },
{ // {
input, // input,
external: [ // external: [
'gsap', // 'gsap',
'vue', // 'vue',
], // ],
output: { // output: {
format: 'cjs', // format: 'cjs',
file: 'build/trois.min.js', // file: 'build/trois.min.js',
sourcemap: true, // sourcemap: true,
}, // },
plugins: [ // plugins: [
...plugins, // ...plugins,
resolve({ // resolve({
moduleDirectories: ['node_modules'], // moduleDirectories: ['node_modules'],
}), // }),
terser(), // terser(),
], // ],
}, // },
]; ];