Releases: curv3d/curv
Release 0.5
Curv Changes since Release 0.4
There are multiple language changes, with deprecation warnings for old
syntax. You should fix deprecation warnings now if you have old Curv code,
because the old syntax will be removed in a future release. By default,
deprecation warnings are throttled. Use curv -v to see all warnings.
Features marked experimental are unstable, subject to change.
Platform/Build Support
Curv 0.5 includes a prebuilt AppImage for Linux.
- @ComFreek -- Windows port.
- @zeeyang: automated MacOS build (using github actions)
- @A-G-D: automated AppImage build for Linux (using github actions)
- Apple Silicon support on Macintosh.
- AMD GPUs supported on Linux using AMD Mesa 19.x driver.
- documented/tested exporting images on a headless Linux server.
make upgradecommand
File Import/Export
- @Xiaoyuew -- Faster mesh export (multi-threaded, multi-core).
- @zeeyang: add
jgpuexport file format (GPU program as JSON) - @zeeyang: add
GLTFexport file format - @zeeyang: remove
curvc(no longer being built) curv dirnamereads a directory as a Curv program (directory format)- JSON export no longer tries hard to distinguish JSON from non-JSON data.
Non-JSON data is now exported as a string.
#fooexports as"foo".sinexports as"<function sin>".
Command Line
- @A-G-D: filename now optional in
curv -le, default isnew.curv - Configuration file
~/.config/curvcontains defaults for -O options,
is a Curv source file, a record containing {viewer,export} fields.
Seedocs/Config.rst - All -O option values are now specified as Curv expressions.
Symbols used in -O options: -Ocolouring=#vertex or -Ocolouring=#face - rename -Ocolour= to -Ocolouring=
--depr=option controls deprecation warnings
REPL
- supports := (assignment) statement
- fully supports generator expressions
helpin REPL is extremely experimental, only partially implemented- see
docs/REPL.rst
Rendering in Viewer Window
- @zeeyang: improved raymarching (backup if overstep due to bad SDF)
- There are configurable render parameters. For a list, use
curv --help.- You can set them on the command line using
-Oname=value.
What's new:valueis an arbitrary Curv expression. - You can set them in the config file, in the
viewersection. [new] - You can set them in a shape value by manually adding a
renderfield
to the shape structure. [new, experimental]
- You can set them on the command line using
- new render parameters:
- ray_max_iter, ray_max_depth: bug #78 [experimental]
shader-- lighting & shadow function for object surface [experimental]
Shape Library
- @lf94: add
lib.builderwithsnowmanexample [experimental] - @lf94: add
sorobanexample - @zeeyang: add 2D
polylineprimitive - @zeeyang: add
repeat_finiteprimitive capped_cone- fix
show_axesto preserve the bounding box - generalized
polygonprimitive (can be non-convex, self-intersecting) - lib.noise [experimental]
a >> into union [b, c]meansunion [a, b, c]
Compiler and Interpreter
- general tail call optimization
- better compile/runtime error messages
- function names in stack traces
- SubCurv enhancements (more things that compile to GLSL shader language):
- numeric matrix data types: 2x2, 3x3, 4x4
- matrix multiplication (
dot) - boolean vector types: bool2, bool3, bool4, bool32
- boolean vector operations: and, or, xor, not
- boolean matrix types: bool2x32, bool3x32, bool4x32
- better support for parametric variables
- add
docs/Implementation(source code structure, lang. implementation)
Curv Language
- Quoted identifiers:
'foo bar'is an identifier with an embedded space.
'if'is an identifier, not a reserved word.'_is an escape sequence
representing a literal'within a quoted identifier. - Numbers
- number patterns like
42or-0.5 signfunction returns -1, 0 or 1sumadded to SubCurv
- number patterns like
- Lists
a++binfix list catenation operator- deprecate
(a,b,c)list syntax; use[a,b,c]instead
- A string like
"abc"is now a list of characters.
Lists are heterogenous, so"abc" ++ [1,2,3]is a list of 6 elements.#"a"is a character literal, and works as a pattern.is_char xis true ifxis a character value.charconverts an integer or list of integers to a character or string.ucodeconverts a character or string to an integer or list of integers.encoderemoved, replaced byucode.decoderemoved, replaced bychar.stringconverts an arbitrary value to a string.- new escape sequences in string literals:
$_->$and"_->"
- Symbols are abstract named values. They replace some uses of strings, but
symbols are scalars, not lists. They replace 'enum' values in some languages.- #foo or #'hello world' is a symbol literal, which works as a pattern.
symbolfunction constructs symbol from stringis_symbolpredicate.- true, false, null are now just aliases for #true, #false, #null
- JSON export exports #true, #false, #null as JSON true, false, null.
- Remove
is_nullpredicate (breaking change).
- Data structure indexing
a.[i]is new array indexing syntax.a[i]is deprecated.r.[#foo]is same asr.foo. Syntax r."foo" is deprecated.a.foo.[i] := ...assignment statements- multi-dimensional array slicing using
a.[indexlist1,indexlist2] - generalized index values (aka lenses, experimental):
a.[i]indexes a data structure with index valuei- integers are index values (they index lists)
- symbols are index values (they index records)
a.[[i1,i2,i3]]yields[a.[i1],a.[i2],a.[i3]]a.[this] yieldsa`a.[tpath[i1,i2]]yieldsa.[i1].[i2]a.[i1,i2]is a multidimensional array slice,
short fora.[tslice[i1,i2]].amend index newelem treeis pure functional update,
liketree.[index]:=newelemwithout the side effect.
- Functions:
is_fundeprecated, replaced byis_funcandis_primitive_funcerroris a function value (previously was magic syntax)id-- identity functionidentityrenamed toidmatrixcomposeis generalized to work correctly on partial functions
- Boolean array operators.
- SubCurv supports new types Bool32, Bool[2-4], Bool[2-4]x32
- experimental boolean array operations (also in SubCurv):
- float_to_bool32, bool32_to_float
- nat_to_bool32 (in SubCurv, argument must be a constant)
- bool32_to_nat (not in SubCurv)
- bool32_sum, bool32_product
- lshift, rshift
- vectorized boolean
notfunction; unary!operator is deprecated - vectorized boolean reduction functions
and,or,xor - vectorized: <, <=, >, >=, bit
select[experimental]
parametricrecords have acallfield that reruns the constructor
with different parameter values. The result is another parametric record,
also with acallfield.testdefinitions, for unit tests in a module, or anywhere elsesc_teststatement, for unit testing SubCurv [experimental]assert_errorstatement, for writing unit tests- comma separated definition lists in
let ...and{...}.
Previously only;was allowed as separator. - in a statement context, () and (a,b,c) are generators.
whereis deprecated, useletinstead.- in a dynamic record literal, [#a,1] is equivalent to a:1, both expressions
locative!func1!func2is a statement, mutates a local variable by
applying one or more functions to the contents.- deprecate "foo":expr, in expression or pattern context.
untilclause for early exit from aforloopvardefinitions are deprecated, uselocaldefinitions instead.local <definition>is a generalized local definition, with sequential
(not recursive) scope. Legal in any imperative context:doexpression,
compound statement, list constructor, dynamic record constructor.- Only definitions are permitted in the head of a
letor in a module
(not actions). Usetestdefinitions to add unit tests to a module. - Remove 'generalized do'. Only
doexpressions are supported. - fewer levels of operator precedence:
- unite Power with Unary; not a breaking change; grammar becomes more liberal.
- unite Relation with Range, breaking change, parse error for
1..3==[1,2,3]
Release 0.4
Graphical value pickers for interactively tweaking shape parameters.
parametricconstructs a parametric shape, with named parameters
that are bound to value-picker types.
See docs/language/Parametric_Shapes.rst- HUD (head up display) overlays the value picker GUI on top of the
shape displayed in the Viewer window.
See docs/Viewer.rst
Contributed features:
- @gsohler: lib.blend
See docs/lib/Blend.rst - @TLC123: new keyboard viewer controls
See docs/Viewer.rst - @s-ol: REPL autocomplete, REPL syntax colouring
Language changes:
- New features used to construct parametric shapes:
- Parametric records (constructed by
parametric) remember how they were
constructed by storing metadata. - Picker predicates specify a value picker type & its configuration.
- Predicate assertion patterns associate a predicate function with a variable.
Syntax isname :: predicate, egpi :: is_num = 3.1416.
Can be used to associate a "type" with a variable definition or function
parameter, or to associate a picker predicate with a shape parameter.
- Parametric records (constructed by
- Imperative programming
- generalized
:=(assignment statement) works on all local variables
defined usinglet,where,for -
vardefinitions are deprecated - generalized
doworks in list/record/string comprehensions - generalized
whileworks in list/record/string comprehensions - See docs/language/Statements.rst
- generalized
- String literals
- multi-line string literals
- new character names: dol, quot, tab
- string comprehensions using ${...}
-
$. $ = ($$ and "" escapes removed) - See docs/language/Strings.rst
- predicate assertion patterns and expressions using ::
- 'pred pat' pattern removed.
- See docs/language/Design_by_Contract.rst
-
whereoperator is now higher precedence than,or;.
a = b where (bindings)is now legal syntax, is equivalent to
a = (b where (bindings)). - calls to
errornow appear in stack trace
Shape Library:
- lib.blend
See docs/lib/Blend.rst cylinderwith no argument iscylinder{d:2,h:2}.boxwith no argument defaults tobox[2,2,2].
Geometry Compiler:
- Experimental support for 1D and 2D arrays of numbers and vectors
See docs/language/Geometry_Compiler.rst - polymorphic == and != (works on vectors and bools now)
- a primitive code optimizer
-o fragfile format replaced by-o gpu.
This is a human readable data file that contains the output of the
Geometry Compiler. This feature is for debugging and developing the
geometry compiler, and the file format is subject to change.
Thecurvtool can now also read GPU files, display them in the Viewer,
and you can live edit them.
Breaking Changes:
- During the development of parametric shapes, the syntax changed multiple times.
It has stabilized with theparametrickeyword. - If you have used the prerelease version of
lib.blend, there are two recent changes:-
lib.blend.stairs(r,n): n is now the # of stair steps -
lib.blend.pipe(d): d is now the pipe diameter
-
- In a string literal, the
$$and""escapes have been replaced by${dol}and${quot}. - The
varvariable definition syntax has been deprecated, will be removed in some future release. - The
pred patpattern syntax has been removed, replaced bypat :: pred.
Other changes:
- Curv now requires OpenGL 3.3
curvcis a new statically linked executable that provides a JSON API for
running Curv programs. It's for @sebastien's Web GUI work, and may be
replaced in the future by a webassembly executable.- fix bug in
-o json(escaping of control characters in string literals) - can export empty/infinite 2D shapes as PNG (defaults to Viewer behaviour)
- use
make uninstallto uninstall Curv - all Curv library files are now stored under /usr/local/lib/curv
Because the location of the library files has changed, you may wish to
perform a clean install by using:
[sudo] make uninstall
[sudo] make install
Viewer, 3D Animation Export, Lib Namespace
Changes from release 0.2:
New options for controlling the viewer window:
- ctrl-W (or command-W on MacOS) closes the window.
- The HOME key or R key resets the camera to its home position. (Ivo Cavalcante)
- -Olazy : Redraw only on user input. Disables animation & FPS counter.
This reduces GPU power consumption on a laptop. (Ivo Cavalcante) - -Obg=colour sets the background colour (default is white).
Use any Curv colour expression, eg-Obg=black. - -Oaa=supersampling_factor : enables spatial antialiasing.
Try 2, 3 or 4, or 1 to disable. This is expensive and slow, but looks nice. - -v : show GLSL shader compile time & object size
- docs: https://github.com/doug-moen/curv/blob/master/docs/Viewer.rst
Other changes to the 3D viewer window:
- You can zoom out further before clipping occurs (Ivo Cavalcante).
- You can zoom in closer before clipping occurs.
New options for PNG export:
- Export of 3D shapes now possible.
- -v : log verbose output to stderr
- -Obg=colour : set background colour
- -Oaa=supersampling_factor : spatial antialiasing, defaults to '4'
- -Oanimate=duration_in_seconds : export an image sequence.
Used to create animated GIFs or video files from an animated shape. - -Ofstart=frame_start_time
- -Ofdur=frame_duration, used with -Oanimate or -Otaa
- -Otaa=supersampling_factor : temporal antialiasing
- PNG export now uses RGB format, instead of RGBA format. Smaller files.
- docs: https://github.com/doug-moen/curv/blob/master/docs/Image_Export.rst
Language changes:
frac nreturns the fractional part ofn.- The hyperbolic functions: sinh cosh tanh asinh acosh atanh.
lib: a hierarchical module namespace for the standard library.lib.web_colour: standard CSS colour names. Eg,lib.web_colour.peach_puff.fileimport now supports directory syntax:
https://github.com/doug-moen/curv/blob/master/docs/language/File_Import.rst
A prerequisite forliband the future package manager.
Other changes:
- Makefile supports
make -j4for parallel compilation (Ivo Cavalcante) - in -Oname=value, values are now Curv expressions.
- Improved error messages.
- Improved --help text.
curv --help -o formatnow documents the -O options
supported by the specified output format. - Various minor bug fixes.
I would like to thank Ivo Cavalcante for his contributions to this release.
File Export and Usability
changes since version 0.1
- Deprecation warning if right argument of
wherenot parenthesized. - new syntax for file export: 'curv -o foo.stl foo.curv'
- mesh export: '-O jit' makes export 33x faster using JIT compiler.
- X3D export: supports both vertex and face colouring.
- PNG export: rewritten and improved.
- STL export: now writes facet normals.
- FRAG export: improved compatibility with shadertoy.com
- add
sortto stdlib. - syntax colouring in gedit, the default text editor.
- colourized error messages.
- improved error messages and more readable stack traces.
- improved 'curv --version' output, for use in bug reports.
- improved 'curv --help' output.
- removed glslViewer dependency, now use OpenGL APIs directly.
- removed readline dependency, now using replxx.
- misc bug fixes and build system improvements.
Mesh Export
- Shapes can be exported as mesh files for 3D printing (.stl, .obj, .x3d).
Full colour 3D printing is supported using .x3d. - The GUI is improved:
curv -le foo.curvcreates a 3 window GUI
for "live editing" a source file. - The interpreter is faster.