Backbone

By this somewhat generic term, we group all the plumbing tools used by an application doing graphics with HOOPS Luminate and that can be freely customized:

  • Memory allocation tools

  • File system tools

  • STL like tools such as the RED::Vector and RED::Map

  • Multi-threading tools: see the RED::Thread class

  • Timing tools: see the RED::Timer class

Memory Allocation Tools

HOOPS Luminate’s uses the default system memory allocator. However, this allocator can be freely changed, by accessing the RED::MemoryAllocator instance of the application.

Accessing and Customizing the Memory Allocator

Let’s start by defining a custom function for allocations performed using the ‘new’ operator:

void* myCustomNew( size_t size )
{
    // Here, set your own memory management code!
    return NULL;
}

Then, we can access the RED::MemoryAllocator and replace the current function by our new function:

// The memory allocator is a singleton:
RED::MemoryAllocator& mal = RED::MemoryAllocator::Get();

// Let's override the 'new' method:
mal.SetCustomNew( myCustomNew );

For simplicity, we do only replace one single memory function in the example above. To fully customize the memory management in HOOPS Luminate, all functions defined in the RED::MemoryAllocator class should be replaced by the application.

Memory Allocation Tracking Tools

HOOPS Luminate can keep track of all allocations it makes. If memory allocation tracking is enabled, then all allocations and de-allocations made by the engine are recorded as a whole. While this can have a significative impact on performances, this allow the application to easily detect memory leaks or to look for memory management errors.

The RED::MemoryLeakTracker is accessed using RED::MemoryAllocator::GetMemoryLeakTracker. Memory allocation tracking is enabled directly on the memory allocator using RED::MemoryAllocator::SetMemoryTracking.

File System Tools

Similarly to the memory tools, HOOPS Luminate’s file system can be customized. The RED::FileSystemTools static interface provides all the necessary methods to customize HOOPS Luminate’s file management methods.

HOOPS Luminate STL Tools

The full HOOPS Luminate API uses a custom implementation of the well known std::vector and std::map classes. These are the RED::Vector and RED::Map classes. HOOPS Luminate uses its own classes to avoid external dependencies with the STL on some platforms and also to ease debugging. The HOOPS Luminate vectors and map can be easily parsed directly from a debugger.

Multi-Threading Tools

The RED::Thread class can be used to launch calculation threads to leverage the calculating power of multiple CPU cores. HOOPS Luminate threads run on Windows, Linux and MacOS systems.

Timing Tools

The RED::Timer is a very small class that can be used quite easily to get accurate timings. It uses operating system proprietary calls to provide an accurate estimation of the elapsed time between two measurement ticks.