Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

Commit

Permalink
feat(physics): add physics impostor support
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainBacon committed Mar 25, 2018
1 parent 11ff473 commit cbc547a
Show file tree
Hide file tree
Showing 17 changed files with 330 additions and 198 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<a name="0.9.0"></a>
# [0.9.0](https://github.com/Beg-in/3d/compare/0.8.0...0.9.0) (2018-03-25)


### Features

* **physics:** add physics impostor support ([2996265](https://github.com/Beg-in/3d/commit/2996265))



<a name="0.8.0"></a>
# [0.8.0](https://github.com/Beg-in/3d/compare/0.7.1...0.8.0) (2018-03-22)


### Features

* **material:** add material with pbr support ([84edf3a](https://github.com/Beg-in/3d/commit/84edf3a))
* **material:** add material with pbr support ([9261b6c](https://github.com/Beg-in/3d/commit/9261b6c))



Expand Down
2 changes: 1 addition & 1 deletion example/animation/template.pug
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Scene
Animation(property="rotation.y" :duration="5" :end="Math.PI * 2")
Animation(property="rotation.z" :duration="5" :end="Math.PI * 2")
PointLight(diffuse="#FF0000")
Box(v-for="position in boxes" :position="position")
Box(v-for="(position, key) in boxes" :key="key" :position="position")
1 change: 1 addition & 0 deletions example/shader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ let { Effect } = require('../../classes');

const VERTEX = require('./vertex.glsl');
const FRAGMENT = require('./fragment.glsl');

const NAME = 'demo';

Effect.ShadersStore[`${NAME}VertexShader`] = VERTEX;
Expand Down
4 changes: 1 addition & 3 deletions lib/animation/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ module.exports = {

props: {
frame: {
validator(value) {
return isFloat(value) || isPercent(value);
},
validator: value => isFloat(value) || isPercent(value),
default: 0,
},

Expand Down
8 changes: 2 additions & 6 deletions lib/camera/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ module.exports = {

props: {
type: {
validator(value) {
return TYPES.includes(value);
},
validator: value => TYPES.includes(value),
default: TYPES[0],
},

position: {
validator: vec3.validator,
default() {
return new Vector3(0, 0, -10);
},
default: () => new Vector3(0, 0, -10),
},

target: vec3,
Expand Down
13 changes: 9 additions & 4 deletions lib/entity/abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ let { id, isDisposable } = require('../util');

module.exports = {
inject: {
_$_sceneReady: 'SceneReady',

_$_parentReady: {
from: 'EntityReady',
default: Promise.resolve(null),
},
_$_sceneReady: 'SceneReady',

$bus: {
from: 'EntityBus',
default: new Vue(),
},

$sceneBus: {
from: 'SceneBus',
default: new Vue(),
},
},

provide() {
Expand All @@ -35,9 +42,7 @@ module.exports = {

name: {
type: String,
default() {
return id();
},
default: id,
},

properties: {
Expand Down
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = {
Entity: require('./entity'),
Property: require('./entity/property'),
Material: require('./material'),
Texture: require('./texture'),
Physics: require('./physics'),

Animation: require('./animation'),
Key: require('./animation/key'),
Expand Down
29 changes: 9 additions & 20 deletions lib/material/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,27 @@ module.exports = {
props: {
diffuse: {
validator,
default() {
return new Color3(1, 1, 1);
},
default: () => new Color3(1, 1, 1),
},

specular: {
validator,
default() {
return new Color3(1, 1, 1);
},
default: () => new Color3(1, 1, 1),
},

emissive: {
validator,
default() {
return new Color3(0, 0, 0);
},
default: () => new Color3(0, 0, 0),
},

ambient: {
validator,
default() {
return new Color3(0, 0, 0);
},
default: () => new Color3(0, 0, 0),
},

reflection: {
validator,
default() {
return new Color3(1, 1, 1);
},
default: () => new Color3(1, 1, 1),
},

alpha: {
Expand Down Expand Up @@ -144,7 +134,6 @@ module.exports = {
return 'bumpTexture';
case 'occlusionTexture':
return 'ambientTexture';
case 'specularTexture':
case 'specularGlossinessTexture':
return 'reflectivityTexture';
default:
Expand Down Expand Up @@ -208,12 +197,12 @@ module.exports = {
},

events: {
setTexture({ name, texture }) {
this.$entity[this.getTextureName(name)] = texture;
setTexture({ property, texture }) {
this.$entity[this.getTextureName(property)] = texture;
},

disposeTexture({ name }) {
this.$entity[this.getTextureName(name)] = null;
disposeTexture({ property }) {
this.$entity[this.getTextureName(property)] = null;
},
},

Expand Down
2 changes: 1 addition & 1 deletion lib/mesh/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const TYPES = {
Lines: 'CreateLines',
LineSystem: 'CreateLineSystem',
Plane: 'CreatePlane',
Polygon: 'CreatePolygon',
PolygonMesh: 'CreatePolygon',
Polyhedron: 'CreatePolyhedron',
Ribbon: 'CreateRibbon',
Sphere: 'CreateSphere',
Expand Down
118 changes: 0 additions & 118 deletions lib/physics/body.js

This file was deleted.

Loading

0 comments on commit cbc547a

Please sign in to comment.