globals: {
document: true,
window: true,
- console: true
+ console: true,
+ Event: true,
+ EventTarget: true,
+ fetch: true,
+ MutationObserver: true
}
},
plugins: {
import { Component } from '@serpentity/serpentity';
+/*
+ * Stores an RGBA color. NOTE: Currently unused as color depends on the
+ * position of the vertex. This is intended to change once we add multiple
+ * curves in a single render.
+ */
export default class Color extends Component {
constructor(config) {
import { Component } from '@serpentity/serpentity';
+/**
+ * Stores global behavior configuration that can be adjusted on the go. For
+ * static configuration see lib/config.js instead.
+ */
export default class Configuration extends Component {
constructor(config) {
import { Component } from '@serpentity/serpentity';
+/**
+ * Stores the radius of a circle or sphere
+ */
export default class Radius extends Component {
constructor(config) {
import { Component } from '@serpentity/serpentity';
+/**
+ * Stores three values of amplitude, intended for a 3D parametric curve.
+ */
export default class TripleAmplitude extends Component {
constructor(config) {
import { Component } from '@serpentity/serpentity';
+/**
+ * Stores three values of frequency, intended for a 3D parametric curve.
+ */
export default class TripleFrequency extends Component {
constructor(config) {
import { Component } from '@serpentity/serpentity';
+/**
+ * Stores three values of phase, intended for a 3D parametric curve.
+ */
export default class TriplePhase extends Component {
constructor(config) {
import { Component } from '@serpentity/serpentity';
+/**
+ * Stores an up vector. Intended for the camera in the scene.
+ */
export default class Up extends Component {
constructor(config) {
+/**
+ * The ID of the main canvas
+ */
export const canvasId = 'lissajous';
+
+/**
+ * The ID of the settings container
+ */
export const settingsId = 'settings';
+/**
+ * The target FPS of the application
+ */
export const fps = 30;
import TripleAmplitude from '../components/triple_amplitude';
import Color from '../components/color';
+/**
+ * This file is a factory for curves.
+ */
+
+/**
+ * Creates a lissajous curve entity
+ */
export function lissajousCurve() {
const entity = new Entity();
import Up from '../components/up';
import Configuration from '../components/configuration';
+/**
+ * This file is a factory for global objects. It doesn't enforce it, but
+ * there should be only one of these entities in the engine at a given
+ * time.
+ */
+
+/**
+ * Creates a data entity that holds the configuration.
+ */
export function configuration() {
const entity = new Entity();
return entity;
}
+/**
+ * Creates a camera, used to modify the 3D view.
+ */
export function camera() {
const entity = new Entity();
+/**
+ * This file is a factory for DOM UI elements.
+ */
+
+/**
+ * Returns a settings container that includes a section and a heading.
+ */
export function settingsContainer({id, label, level=2}) {
const container = document.createElement('section');
return container;
};
+/**
+ * Returns a slider that includes a label, and can optionally be set to
+ * "shift" to a different step. (eg. we use this for π mode, where frequency
+ * and amplitude are mapped to π/8 increments.
+ */
export function slider({
id,
min,
}
};
+/**
+ * UI that adjusts the amplitude of any compatible object
+ */
export default class AmplitudeAdjuster extends System {
constructor(container) {
}
};
+/**
+ * UI that adjusts the parameters of the camera
+ */
export default class CameraAdjuster extends System {
constructor(container) {
import { System } from '@serpentity/serpentity';
import Cameras from '../nodes/cameras';
+/**
+ * Rotates the camera around a "sphere"
+ */
export default class CameraRotator extends System {
constructor() {
import Frequent from '../nodes/frequent';
import { settingsContainer, slider } from '../factories/ui';
+/**
+ * UI that adjusts the frequency of any compatible object
+ */
const internals = {
symbols: {
a: '𝛼',
import Frequent from '../nodes/configurable';
import { settingsContainer, slider } from '../factories/ui';
+/**
+ * UI that adjusts global configuration settings for the scene.
+ */
export default class GlobalAdjuster extends System {
constructor(container) {
kPeriod: Math.PI * 12000000
};
+/**
+ * Calculates the lissajous curve over time
+ * NOTE: This shouldn't store data, I should have a different entity for
+ * the actual drawable vertices. Either put the storage in the curve, or
+ * create a separate entity.
+ */
export default class WebGLRenderer extends System {
constructor() {
}
};
+/**
+ * UI that adjusts the phase of any compatible object
+ */
export default class PhaseAdjuster extends System {
constructor(container) {
`
};
+/**
+ * Does all the WebGL rendering. I'm not super familiar with WebGL so I need
+ * to revisit this in a while and see how I would restructure this.
+ */
export default class WebGLRenderer extends System {
constructor(canvas) {
}
+/**
+ * Loads and compiles a shader
+ */
function loadShader(gl, type, source) {
const shader = gl.createShader(type);