]>
git.r.bdr.sh - rbdr/lissajous/blob - lib/factories/global.js
1 import { Entity
} from '@serpentity/serpentity';
2 import Position
from '@serpentity/components.position';
3 import EulerAngle
from '@serpentity/components.euler_angle';
4 import Velocity
from '@serpentity/components.velocity';
5 import Radius
from '../components/radius';
6 import Up
from '../components/up';
7 import Configuration
from '../components/configuration';
10 * This file is a factory for global objects. It doesn't enforce it, but
11 * there should be only one of these entities in the engine at a given
16 * Creates a data entity that holds the configuration.
18 export function configuration() {
20 const entity
= new Entity();
21 entity
.addComponent(new Configuration());
27 * Creates a camera, used to modify the 3D view.
29 export function camera() {
31 const entity
= new Entity();
32 entity
.addComponent(new Position());
33 entity
.addComponent(new EulerAngle());
34 entity
.addComponent(new Velocity({
39 entity
.addComponent(new Radius({
42 entity
.addComponent(new Up());