Primitives

Vercidium Audio operates against a low-poly copy of the world, similar to a physics engine.

To add a primitive to the simulation, invoke the AddPrimitive function on the context:

var prism = new PrismPrimitive()
{
    // Every primtiive must have a material
    material = MaterialType.Metal,
    
    // Size MUST be separate to the transform
    size = new Vector3F(15),

    // Rotate and position it
    transform = Matrix4F.CreateRotationX(MathF.PI / 4) *
                Matrix4F.CreateTranslation(32, 32, 32)
};

context.AddPrimitive(prism);

An exception will be thrown if a primitive is created with MaterialType.Air.

Below is the full list of primitives.

Updating Primitives

The position/rotation/material/etc of primitives can be updated at any time, even while the background raytracing threads are running. The updates will apply when the background threads finish running.

When a primitive is updated, it will automatically be flagged as 'dirty'. The context keeps track of all dirty primitives, and will refresh the bounding volume hierarchy (BVH) that is used to speed up raytracing intersections.

This all occurs on background threads so there should be minimal impact on the main thread, but raytracing will be slightly delayed by this preparation work. You can check how long preparation and BVH updates take via the context.PreparationTime field.