Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/framework/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ var _deprecationWarning = false;
* * model ({@link ModelComponentSystem})
* * particlesystem ({@link ParticleSystemComponentSystem})
* * rigidbody ({@link RigidBodyComponentSystem})
* * render ({@link RenderComponentSystem})
* * screen ({@link ScreenComponentSystem})
* * script ({@link ScriptComponentSystem})
* * scrollbar ({@link ScrollbarComponentSystem})
Expand Down
3 changes: 0 additions & 3 deletions src/framework/components/render/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Component } from '../component.js';
import { EntityReference } from '../../utils/entity-reference.js';

/**
* @private
* @component
* @class
* @name RenderComponent
Expand Down Expand Up @@ -241,7 +240,6 @@ class RenderComponent extends Component {
}

/**
* @private
* @function
* @name RenderComponent#hide
* @description Stop rendering {@link MeshInstance}s without removing them from the scene hierarchy.
Expand All @@ -258,7 +256,6 @@ class RenderComponent extends Component {
}

/**
* @private
* @function
* @name RenderComponent#show
* @description Enable rendering of the render {@link MeshInstance}s if hidden using {@link RenderComponent#hide}.
Expand Down
1 change: 0 additions & 1 deletion src/framework/components/render/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const _properties = [
];

/**
* @private
* @class
* @name RenderComponentSystem
* @augments ComponentSystem
Expand Down
2 changes: 2 additions & 0 deletions src/framework/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Application } from './application.js';
* @property {LightComponent} [light] Gets the {@link LightComponent} attached to this entity. [read only]
* @property {ModelComponent} [model] Gets the {@link ModelComponent} attached to this entity. [read only]
* @property {ParticleSystemComponent} [particlesystem] Gets the {@link ParticleSystemComponent} attached to this entity. [read only]
* @property {RenderComponent} [render] Gets the {@link RenderComponent} attached to this entity. [read only]
* @property {RigidBodyComponent} [rigidbody] Gets the {@link RigidBodyComponent} attached to this entity. [read only]
* @property {ScreenComponent} [screen] Gets the {@link ScreenComponent} attached to this entity. [read only]
* @property {ScriptComponent} [script] Gets the {@link ScriptComponent} attached to this entity. [read only]
Expand Down Expand Up @@ -107,6 +108,7 @@ class Entity extends GraphNode {
* * "light" - see {@link LightComponent}
* * "model" - see {@link ModelComponent}
* * "particlesystem" - see {@link ParticleSystemComponent}
* * "render" - see {@link RenderComponent}
* * "rigidbody" - see {@link RigidBodyComponent}
* * "screen" - see {@link ScreenComponent}
* * "script" - see {@link ScriptComponent}
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ export { ParticleSystemComponent } from './framework/components/particle-system/
export { ParticleSystemComponentSystem } from './framework/components/particle-system/system.js';
export { PostEffectQueue } from './framework/components/camera/post-effect-queue.js';
export * from './framework/components/rigid-body/constants.js';
export { RenderComponent } from './framework/components/render/component.js';
export { RenderComponentSystem } from './framework/components/render/system.js';
export { RigidBodyComponent } from './framework/components/rigid-body/component.js';
export { RigidBodyComponentSystem, ContactPoint, ContactResult, RaycastResult, SingleContactResult } from './framework/components/rigid-body/system.js';
export { SceneRegistry } from './framework/scene-registry.js';
Expand Down
30 changes: 30 additions & 0 deletions src/resources/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,42 @@ class ContainerResource {
this.registry = null;
}

/**
* @function
* @name ContainerResource#instantiateModelEntity
* @description Instantiates an entity with a model component.
* @param {object} [options] - The initialization data for the model component type {@link ModelComponent}.
* @returns {Entity} A single entity with a model component. Model component internally contains a hierarchy based on {@link GraphNode}.
* @example
* // load a glb file and instantiate an entity with a model component based on it
* app.assets.loadFromUrl("statue.glb", "container", function (err, asset) {
* var entity = asset.resource.instantiateModelEntity({
* castShadows: true
* });
* app.root.addChild(entity);
* });
*/
instantiateModelEntity(options) {
var entity = new Entity();
entity.addComponent("model", Object.assign( { type: "asset", asset: this.model }, options));
return entity;
}

/**
* @function
* @name ContainerResource#instantiateRenderEntity
* @description Instantiates an entity with a render component.
* @param {object} [options] - The initialization data for the render component type {@link RenderComponent}.
* @returns {Entity} A hierarachy of entities with render components on entities containing renderable geometry.
* @example
* // load a glb file and instantiate an entity with a model component based on it
* app.assets.loadFromUrl("statue.glb", "container", function (err, asset) {
* var entity = asset.resource.instantiateRenderEntity({
* castShadows: true
* });
* app.root.addChild(entity);
* });
*/
instantiateRenderEntity(options) {
// helper function to recursively clone a hierarchy while converting ModelComponent to RenderComponents
var cloneToEntity = function (skinInstances, model, node) {
Expand Down