Abstract:
The FunWorlds project aims to combine and integrate ideas from
functional programming, in particular functional reactive
programming a la Fran, and virtual worlds, as exemplified by the
Virtual Reality Modeling Language (VRML'97). The goal of our
research is the design of a concrete toolkit offering functional
programmers access to this rich medium for communication and
interaction while introducing virtual reality scene authors to an
expressive high-level modeling paradigm.
In earlier work, reported at IFL'2001, we experimented with mapping
Fran concepts into VRML'97, using a domain-specific embedded
compilation approach to map high-level programs in a Haskell DSEL
into standard VRML'97 + ECMAScript worlds, render- and navigable
using any VRML'97 browser. The present paper is concerned with a
more direct integration, based on Sven Panne's HOpenGL Haskell
binding to the industry standard for 2d and 3d graphics, OpenGL.
To enable a declarative approach, we first introduce a simple scene
graph similar to the static aspects of VRML, which is translated
into calls to the imperative HOpenGL API. To address dynamic aspects
of our scenes, we build on ideas taken from Conal Elliott's Fran
(functional reactive animation). However, Fran itself has gone
through a series of implementations of increasing complexity and
difficult-to-predict performance. We trace some of those problems to
issues in the design of the Fran DSEL and choose to deviate from
this original Fran design in several points. Without unduly
restricting expressiveness, our more pragmatic design leads to a
drastically simplified implementation offering competitive, and more
importantly, predictable performance.
Abstract: The Virtual Reality Modeling Language (VRML) is a standard format for describing interactive 3d content, especially on the world-wide web. It combines declarative specifications of static scenes with imperative manipulations of scene graphs to realise dynamic scenes. Functional reactive animation (Fran) is a domain-specific modeling language for graphical animations and multimedia. Fran has convincingly demonstrated the value of an entirely declarative approach to modeling built around the concepts of time-varying behaviours interacting with discrete events, embedded in a functional host language enriched with domain-specific primitives (graphics in the case of Fran). One of Fran's ancestors, named ActiveVRML, was put forward as a proposal for VRML 2.0 by Microsoft graphics groups. It failed to gain acceptance for a variety of reasons, but mostly because its concepts remained alien to the community driving the VRML standardisation process. We set out to re-examine the design space for interactive 3d content, taking the current standard VRML'97 and Fran as yardsticks. The present paper reports on our experience in mapping Fran concepts into VRML'97. We prototype our suggestions as an embedded compiler in Haskell, generating standard VRML'97+ECMAScript code from concise declarative descriptions. The results are promising in two directions: first, they give the functional programming community access to a rich output medium for animated, interactive 3d content, employing standard technology, but avoiding low-level specifications. Second, the mapping will help to compare Fran, which developed out of ActiveVRML, with VRML'97, which developed out of a competing proposal for VRML 2.0, hopefully helping the VRML community to re-assess the values of Fran's concepts.