Skip to content

Commit

Permalink
Added pc.ModelComponent#meshInstances property which proxies pc.Model…
Browse files Browse the repository at this point in the history
…#meshInstances to avoid code like this.entity.model.model.meshInstances (which now becomes this.entity.model.meshInstances)
  • Loading branch information
vkalpias committed Jun 22, 2016
1 parent b0a1dd1 commit 5aaf8d8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/framework/components/model/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pc.extend(pc, function () {
* @property {Boolean} castShadowsLightmap If true, this model will cast shadows when rendering lightmaps
* @property {Boolean} lightmapped If true, this model will be lightmapped after using lightmapper.bake()
* @property {Number} lightmapSizeMultiplier Lightmap resolution multiplier
* @property {[pc.MeshInstance]} meshInstances An array of meshInstances contained in the component's model
*/

var ModelComponent = function ModelComponent (system, entity) {
Expand Down Expand Up @@ -639,6 +640,15 @@ pc.extend(pc, function () {
}
});

Object.defineProperty(ModelComponent.prototype, 'meshInstances', {
get: function () {
return this.model.meshInstances;
},
set: function (value) {
this.model.meshInstances = value;
}
});

return {
ModelComponent: ModelComponent
};
Expand Down

0 comments on commit 5aaf8d8

Please sign in to comment.