simonbates / procdraw-old Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Use the Phong reflection model or the Blinn–Phong reflection model.
Such as:
def
(Python)defn
(Clojure)defun
(Common Lisp)as a shorter way of writing (setq name (lambda ...))
Either with a list comprehension or by building a list of all combinations.
See:
Store this data pointer on LispCFunction and add to lisp_CFunction.
Pass the data pointer value to the registered function when we call the function in LispInterpreter::ApplyCFunction().
Use this generic data pointer to provide callback context -- in particular to store a pointer to ProcDrawAppSdl when registering functions in procdraw_app_sdl_lisp.cpp. We can then get rid of the pd_app global variable.
(for-each list fun)
Depends on:
Such as keeping a history of what was drawn and then redrawing it for some number of frames.
(make-table)
(get key table)
(put key val table)
Streams of bitmap images implementing the Signal interface.
For doing real time image processing.
The rendering process could be modified to act as a signal generator so that I could do full-screen post processing on the rendered images.
Depends on #1
(camera x y z)
(look-at x y z)
(camera-up x y z)
In the to_port
directory.
And update the coding.md file.
See: "Prettyprinting" by Derek Oppen
Also: "XP. A Common Lisp Pretty Printing System" by Richard C. Waters
Some syntax options:
(setq saw1 (saw 10))
(setq saw1 (saw 'freq 10))
(setq saw1 (saw {'freq 10}))
rather than
(setq saw1 (saw))
(put saw1 'freq 10)
(map-range start1 stop1 start2 stop2 val)
[DONE](wrap start stop val)
[DONE](lerp start stop val)
[DONE](norm start stop val)
[DONE]Either:
Some implementation options:
To save and backtrack to world matrix states.
To make patching easier by removing the need to convert between ranges with map-range.
For cases when we need to map from [0, 1] to another range, add a lerp function. We can use lerp rather than the full map-range.
(lerp v0, v1, t)
returns an interpolation between two values (v0, v1) for a parameter t in the range [0, 1]
see https://en.wikipedia.org/wiki/Linear_interpolation
Also add a norm function which normalizes a value form some range to [0, 1], like Processing:
Which recurses into conses, comparing their components.
See http://www.lispworks.com/documentation/HyperSpec/Body/f_equal.htm#equal
As if prefixed by "test that..." or "check that...".
A Signal is a Table [#17] that can be stepped forward in time:
(step signal)
Patches are graphs of Signals and implement the above Signal API:
(make-patch)
(add-node patch name signal)
(=> patch source-node source-key dest-node dest-key &optional fn)
An example:
(progn
(setq p (make-patch))
(add-node p osc1 (sine-osc))
(add-node p osc2 (sawtooth-osc))
(=> p in mouse-x osc1 freq)
(=> p osc1 val osc2 freq)
(=> p osc1 val out velocity)
(=> p osc2 val out rotation)
(setq draw (lambda ()
(progn
(put mouse-x (mouse-x) p)
(step p)
(rotate-y (get rotation p))
(color (get velocity p)))))
Alternatively, with a separate Signal namespace (and the Signals in that namespace stepped implicitly):
(progn
(defsig osc1 (sine-osc))
(defsig osc2 (sawtooth-osc))
(=> (mouse-x) osc1 freq)
(=> osc1 val osc2 freq)
(setq draw (lambda ()
(progn
(rotate-y (getsig osc2 val))
(color (getsig osc1 val)))))
In this model, I can do the stepping lazily -- we step if needed when the signal is read (and in turn step any dependencies). Keep a flag for each Signal which records if it has been stepped for this frame. And reset the flags at the start of each frame.
Another possibility -- not in a separate namespace and with a single output:
(progn
(setq osc1 (sin-osc))
(setq osc2 (saw))
(=> (lambda () (lerp 0 (/ 60) (mouse-x))) osc1 'freq)
(=> (lambda () (lerp (/ 240) (/ 60) (sigval osc1))) osc2 'freq)
(setq draw (lambda ()
(progn
(rotate-y (sigval osc2))
(color (sigval osc1)))))
The function sigval steps the Signal as needed and gets values from dependencies. To know which Signals have been stepped for each frame, I can maintain a set of Signals that have been stepped and clear it out at the start of each frame. This way, I don't need to be able to enumerate all the Signals.
Some ideas:
Such as:
\
(Haskell)fn
(Clojure, Standard ML)fun
(Erlang, OCaml)func
(Go)To support ' syntax.
Use Hz for oscillator frequencies rather than cycles per frame.
Mapping Hz to cycles per frame will depend on exactly how I proceed with updating the signals vs rendering ('game loop'). But if I continue with vsync, then:
Options:
std::unordered_map<std::string, LispObjectPtr>
A waveform generator is a type of Signal [#16].
Start with sawtooth.
I can then replace:
(setq rotation-y-velocity (map-range 0 (width) (/ pi 60) (/ pi -60) (mouse-x)))
(setq rotation-y-angle (wrap-range 0 (* 2 pi) (+ rotation-y-angle rotation-y-velocity)))
(rotate-y rotation-y-angle)
in animating.lisp
with something more like:
(setq rotation-y-osc (make-sawtooth))
...
(put freq (mouse-x) rotation-y-osc)
(step rotation-y-osc)
(rotate-y (get val rotation-y-osc))
(ignoring any mapping from value ranges)
See also Patches [#16].
Article on dependency graphs in updating game objects: http://www.gamasutra.com/view/feature/131221/dependency_graphs_in_games.php
Add a new eof type.
And use in the REPL to prompt the user to finish the expression.
Depends on #47.
So we can write:
(lambda ()
(f)
(g))
rather than needing:
(lambda ()
(progn
(f)
(g)))
Either interface directly with the device or via OSC.
Use the original data set and tessellate it myself.
And minimise the runtime, with as much as possible structured as extensions.
I have:
Create a standard structure for expressing extensions. Maybe an object with a Register() function. Or an Exports() function.
With the addition of the void *data parameter to LispInterpreter::SetGlobalCFunction(), I should be able to bind directly to the GLRenderer instance, rather than going through ProcdrawApp.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.