Skip to content

Instantly share code, notes, and snippets.

@drcmda
drcmda / .js
Created October 24, 2016 15:10
plugin specs, draft nearing final: SESSION USE
import Session from 'awv3/session';
// Create session
const session = window.session = new Session({
debug: true,
connection: 'http://localhost:8181/'
});
// Wait until we're connected
session.onConnected().then(server => {
@drcmda
drcmda / .js
Last active October 24, 2016 15:07
plugin specs, draft nearing final: PLUGIN DEFINITION
import Plugin from 'awv3/session/plugin';
import { Group, Button, Input, Label, Selection, Checkbox, Dropdown } from 'awv3/session/elements';
export default class extends Plugin {
constructor(session, { name }) {
super(session, { type: "Measure", name });
// 1. Elements SHOULD be created in the constructor. They can be stored in any way or form,
// in this case we use 'this' so that they are accessibable throuout the plugin
@drcmda
drcmda / gist:9d308cb293781f322c77ad03e47e741f
Created September 16, 2016 08:30
multiple interaction handles, keyed
application
canvas
scene
class VersatileObject(obj1) -> eventhandler
obj2 -> eventhandler
obj3 -> eventhandler
plugins
UI elements [selection] -> notify
pluginsystem->events->override
import Plugin from 'awv3/plugin/base';
import Integration from 'awv3/plugin/integration';
class MyPlugin extends Plugin {
constructor() {
super();
// ... functionality
}
}
@drcmda
drcmda / .js
Last active July 20, 2016 12:37
plugin archtitecture
// import and create canvs
import Canvas from 'awv3';
const canvas = new Canvas({ dom: '#view' });
// import plugins, they should be separate from the awv3-repo
import Sketcher from 'awv3-sketcher';
import Extrusion from 'awv3-extrusion';
import Measuring from 'awv3-measuring';
// create measure layer, "use" it Node style
@drcmda
drcmda / .js
Created July 8, 2016 09:54
toolbuilder
// 'url', default URL, depends on the analyzer running online or local
// 'Canvas', 'View', 'SocketIO' & 'Object3' from AWV3-next
// 'log' (.start(), .stop(message) & .printResults(string || object))
log.start();
let tasks = [];
let task = new SocketIO().connect(url).then(connection => {
// Clear scene
[
{ "type": "Geometry", "name": "Tischplatte", "id": 6, "data": [base128], "meta": {} },
{ "type": "Geometry", "name": "Tischbein", "id": 7, "data": [base128], "meta": {} },
{ "type": "Model", "name": "Tisch", "id": 8,
"data":[
{ "type": "Link", "ref": "Tischplatte", "matrix": [0,0,0], "meta": {} },
{ "type": "Link", "ref": "Tischbein", "matrix": [0,0,0], "meta": {} },
{ "type": "Link", "ref": "Tischbein", "matrix": [0,10,0], "meta": {} },
{ "type": "Link", "ref": "Tischbein", "matrix": [10,0,0], "meta": {} },
import Parser from 'parser';
export default class {
constructor(pool) {
this.pool = pool;
return attribs => {
switch (attribs.type) {
case Parser.Factory.Link:
let { ref, matrix } = attribs.data;
@drcmda
drcmda / *.js
Last active March 21, 2016 15:05
client assembly via custom factory first draft
// Application ------------------------------------------------------------------------
import AssemblyFactory from 'factory/assembly'
// Create factory, link it to the scene, or whereever models are stored in the application
let factory = new AssemblyFactory(scene);
// Request a table
server.request('_O.CreateTable()', factory);
// Request a clone
server.request('_O.Clone(0)', factory);
@drcmda
drcmda / .js
Created March 15, 2016 16:30
new gist
import 'requestidlecallback';
import Canvas from 'canvas';
import View from 'view';
import Object3 from 'three/object3';
import Animation from 'animation';
import { Performance } from 'helpers/misc';
// Create new canvas
const canvas = new Canvas({ dom: '#main' });
// Create a view, defaults into the same dom as the canvas