HOOPS/Stream Technical Overview
Overview
The ‘base’ classes of the HOOPS Stream Toolkit are intended to be used to export an HSF file when the graphics information is stored in a custom scene graph or set of application data-structures, or to import an HSF file which needs to be mapped to these types of data structures.
If the data to be exported to an HSF file already resides in the HOOPS 3D Graphics System (HOOPS/3DGS) scene graph, or if data being imported from an HSF file needs to be mapped to the HOOPS/3DGS scene graph, then the ‘3DGS’ classes should be used. The work of exporting the HOOPS/3DGS scene graph information to an HSF file, or mapping an HSF to a HOOPS/3DGS scene graph is encapsulated by the ‘3DGS’ classes. These classes and the full HOOPS 3D Graphics System are included with the HOOPS 3D Application Framework (HOOPS/3dAF). Developers who are currently using the standalone HOOPS/Stream Toolkit (which only contains the ‘base’ classes) can contact Tech Soft 3D for information about licensing the HOOPS 3D Application Framework.
Architecture
During the export phase, the toolkit generates data buffers which contain the encoded, compressed, binary HSF representation of scene graph objects or custom user data. The toolkit provides built-in support for exporting these buffers to a file, but they can also be exported to a user-specified location. In this case, the developer supplies a buffer and buffer size, and the toolkit fills it with HSF data.
When importing, data buffers are passed to the toolkit for parsing and insertion into the appropriate data structures. Similar to the export process, data could also be imported from a user-specified location. (The developer gets a buffer of HSF data from their own data structures, from their own proprietary file, or perhaps it is sent as part of a message over a network connection, and the data is then passed to the toolkit.)
The following diagram provides an abstract, platform and GUI-independent overview of HSF file export/import using the toolkit:
Opcode Handlers
An HSF file consists of opcodes, each of which is followed by a corresponding set of operands that define a logical piece of data. HOOPS/Stream utilizes ‘opcode handlers’ to manage reading and writing of HSF objects. A set of default opcode handlers support the scene graph objects which are supported by the HOOPS 3D Graphics System; these include segments, attributes and geometry. However, the toolkit can be extended by deriving from the existing opcode handlers to export/import extra information that is appended to default objects or by adding new opcode handlers to export/import user-specific data.
The following diagram shows default opcode handlers that have been customized, along with a user-defined opcode handler:
Streaming HSF Data
Streaming of graphical data typically refers to a process whereby graphical information is retrieved from a remote location such as a website or server and is displayed as soon as it is received by the client application. It allows the end-user to quickly obtain some visual feedback, as well as interact with the scene as it is still being displayed. The data buffer generation and parsing capabilities of the HOOPS/Stream toolkit, combined with its ability to create stream-enabled files, make it well suited for streaming data.
When streaming, it is useful for the reading process to occur asynchronously on a thread separated from the main application thread. This involves making platform and GUI specific function calls to create a new thread which continually obtains data buffers. This thread would then post a message to the main thread’s event loop indicating that a new buffer is ready for drawing. If the HOOPS/Stream Toolkit is being used in a standalone fashion, then this GUI-specific streaming logic must be written by the developer.
The HOOPS 3D Application Framework includes various GUI-specific modules (HOOPS/ActiveX, HOOPS/MFC, and HOOPS/Qt) to encapsulate the platform and GUI-specific logic required to support streaming of HSF files from either a local file, or from a website (URL). These modules provide a set of base classes from which developers can derive their own custom application classes and ActiveX controls.)
The HOOPS/Stream Toolkit has a client-side only architecture. It does not require deployment and configuration of any server-side modules, and is server-independent. Future versions of the toolkit may provide an optional server-side module as well. If the file resides on a remote webserver, having server-side logic enables support for additional features such as accessing specific parts of the remote file, view-dependent streaming, etc…