Skip to content

Latest commit

 

History

History
150 lines (119 loc) · 5.35 KB

facet.org

File metadata and controls

150 lines (119 loc) · 5.35 KB

The Big List of Facet TODOs

BUGS

Documentation fixes

Optimizer

Common subexpression elimination

Without relying on the AST, that is.

cast chain optimization

float(float(x)) => float(x),

float(x) => x, if x is known to be float

Generally, idempotent chain optimizations.

Logical expression optimizations

Initialization optimization for conditional expressions.

Types

Function types

These will be useful when we have user-defined GLSL.

Loops of some kind.

Streams of value-generating expressions seem appropriate, since we can constrain the generator to be finite.

user-defined glsl

Invariance declarations

Typechecking code review

functions like cosh which just build other expressions should have stricter type checking.

It should be possible to implement some form of static checking for Shade.make when passing functions.

Documentation

NeHe Lessons

Change lesson2.html to reflect camera class.

We need a “pitfalls”. For example, zoom.get() vs. zoom…

Expressions

ternary op performance fixes.

Right now the algorithm in place is correct, but conservative. Ideally, I will want to propagate BDDs up the expression tree and check them

precision declarations

Rendering

Batch Drawing Mode and Scene Rendering Mode

Batches can be drawn in different modes, currently:

  • “regular” drawing
  • additive blending
  • alpha-blended

But scenes can also be rendered in different modes, currently

  • regular drawing mode
  • picking mode
  • depth unproject mode

These two possibilities interact, and the result is a double dispatch, currently implemented badly on Facet.DrawingMode.*

This should be fixed.

Namely, the Facet.DrawingMode.<foo>.set_<bar>_caps functions dispatch on both foo and bar.

One better solution is to have a dictionary and dispatch on (<foo>, <bar>) pairs.

This would pave the way for extensible batch drawing modes. But extending rendering modes is not as easy because, for example, the picking procedure requires extra state to be kept around. This should be designed carefully (in other words, I’m afraid of trying it out right now)

API

Support for boolean vectors

Part of it exists throughout Facet, but it’s scattered and untested.

I really should have a matrix stack.

I should have a camera class

This class would expose Shade functions to perform transformations. A cool demo would be a real non-linear fisheye distortion projection. Obviously tesselation would be necessary, but it’d get the point across.

There should be an API for strided attribute buffers.

The advantage here is that I could get different attributes from a single bound array buffer. This would reduce the overhead of binding the different attributes when switching state.

The main difficulty is that I currently assume a one-to-one relationship between array buffers and attributes throughout the API.

Fix inconsistent case conventions between Shade and GLSL

The way to do this is to add underscore_equivalents of the GLSL ugly camelCase functions. This way, people familiar with GLSL can use them, while people coming directly to Facet will use underscore

“Selection” is a terrible name. Fix it.

Shade.Utils is terrible. Move that stuff to Shade.Scale or something like that.

Shade.model vs Shade.bake is getting annoying. Find a way out.

Testing/Engineering

fix the _shade_type ugliness

One possibility is to create a WebGLObject prototype that knows how to turn itself into a Shade expression

runtime type information

It is very convenient to use runtime type checking to get polymorphism, but it seems like it tends to proliferate along the code. I should try to consolidate all these calls in a single API of some sort.

Write test suite for all builtins constant folding

I’ve been seeing a lot of infinite loops because of co-recursion in constant_value. What do I do about it?

Update: the issue here is that many expressions lack a true definition of element(), and so when element(i) returns element.at(i), at(i).element() runs the risk of diverging.

This should go together with writing the semantics for Shade expressions.

Typechecking code review

functions like cosh which just build other expressions should have stricter type checking.

Code review on FIXMEs

Review best practices on exception raising/handling in JS.

Multiple WebGL canvases in a same page

This means multiple contexts, and lots of things are going to break. We already have set_context, but many calls use a possibly stale context on the closure scope. A code review and tests are in order.

Features

More basic marks

Now that I figured out a nice way to make aligned rects work, I should extend this to lines, etc. The main problem is interaction with attribute_buffer, but that’s inevitable without geometry shaders. I’ll need documentation.

TEXT SUPPORT

WebGL FBOs are square?!

According to the spec, they must be square. But I can create them in WebGL without any trouble. I wonder if things will break.

Mousewheel support

I’ve done this one-off in the beauty of roots demo. Maybe I shouldn’t integrate it and leave it instead to app writers. But it’s a type of interaction that’s bound to be necessary over and over again…

Other