This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createContext = require('pex-context') | |
const createCube = require('primitive-cube') | |
const mat4 = require('pex-math/mat4') | |
const ctx = createContext({ width: 640, height: 480 }) | |
const cube = createCube() | |
const clearCmd = { | |
pass: ctx.pass({ | |
clearColor: [0, 0, 0, 1], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pl.vorg.carrot { | |
import flash.display.*; | |
import flash.events.*; | |
import flash.text.*; | |
import flash.utils.*; | |
import mx.utils.*; | |
import pl.vorg.geom.*; | |
import pl.vorg.text.*; | |
import pl.vorg.utils.*; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createContext = require('pex-context') | |
const ctx = createContext({ width: 1280, height: 720}) | |
const drawCmd = { | |
pass: ctx.pass({ | |
clearColor: [0.5, 0.5, 0.5, 1], | |
clearDepth: 1 | |
}), | |
pipeline: ctx.pipeline({ | |
vert: vertSrc, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const depthPassCmd = ctx.command({ | |
name: 'depthPass', | |
framebuffer: shadowFramebuffer, | |
viewport: [0, 0, depthMapSize, depthMapSize], | |
clearColor: [1, 1, 0, 1], | |
clearDepth: 1 | |
}) | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1 curent, plain prop | |
var tree = { | |
height: 1 | |
} | |
console.log(tree.height) | |
gui.addParam('Height', tree, 'height', { min: 0, max: 10 }) | |
// 2 prop with metadata | |
var tree = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pull = require('pull-stream') | |
const log = require('pull-stream/sinks/log') | |
const filter = require('pull-stream/throughs/filter') | |
const take = require('pull-stream/throughs/take') | |
const containsPoint = require('pex-geom/Rect').containsPoint | |
const pushableStream = require('pull-pushable') | |
// Draw a red canvas with yellow "button" on the left | |
const btnRect = [[10, 10], [100, 100]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Streams implementation for mouse events. | |
// Started based thinking in https://github.com/pex-gl/pex-gui/issues/8 | |
// IMPORT DEPENDENCIES | |
// Flyd is "The less is more, modular, functional reactive programming library" | |
const flyd = require('flyd') | |
// emit events from one stream until another stream fires | |
const takeUntil = require('flyd/module/takeuntil') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var regl = require('regl')() | |
var setupViewWorking = regl({ | |
scissor: { | |
enable: true, | |
box: {x: 0, y: 0, width: 100, height: 100} | |
} | |
}) | |
var setupViewNotWorking = regl({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Welcome! require() some modules from npm (like you were using browserify) | |
// and then hit Run Code to run your code on the right side. | |
// Modules get downloaded from browserify-cdn and bundled in your browser. | |
var gl = require('pex-gl')(600, 300) | |
var io = require('pex-io') | |
var regl = require('regl')(gl) | |
function loadImageBrowser (url, callback) { | |
console.log('hacking image loader') | |
var img = new window.Image() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var regl = require('regl')() | |
regl.clear({ | |
color: [0, 0, 0, 1], | |
depth: 1 | |
}) | |
// In regl, draw operations are specified declaratively using. Each JSON | |
// command is a complete description of all state. This removes the need to | |
// .bind() things like buffers or shaders. All the boilerplate of setting up |