udBlockRenderContext

The udBlockRenderContext object provides an interface to render Nuclideon Unlimited Detail models, with callbacks to enable GPU renderering. It provides the ability to render by colour, intensity or classification; additionally allowing the user to query a specific pixel for information about the pointcloud data.

Functions

udDouble3 udBlockRenderVertexData_GetFloatPosition(const struct udBlockRenderVertexData *pData, uint32_t index)

Retrieves a voxel position in model space.

ParameterDescription
pDataThe block vertex data to query.
indexThe voxel index.

Returns: The voxel position in model space

enum udError udBlockRenderContext_Init(struct udBlockRenderGPUInterface *pGPUInterface)

Create an instance of udBlockRenderContext for rendering.

ParameterDescription
pGPUInterfaceThe pointer of the user-defined callbacks interface.

Returns: A udError value based on the result of the render context creation.

enum udError udBlockRenderContext_Deinit()

Destroy the instance of the renderer.

ParameterDescription
ppRendererThe pointer pointer of the udRenderContext. This will deallocate the instance of udRenderContext.

Returns: A udError value based on the result of the render context destruction.

enum udError udBlockRenderContext_Render(struct udRenderContext *pRenderer, struct udRenderTarget *pRenderView, struct udRenderInstance *pModels, int modelCount, struct udRenderSettings *pRenderOptions)

Render the models from the perspective of pRenderView.

ParameterDescription
pRendererThe renderer to render the scene.
pRenderViewThe view to render from with the render buffers associated with it being filled out.
pModelsThe array of models to use in render.
modelCountThe amount of models in pModels.
pRenderOptionsAdditional render options.

Returns: A udError value based on the result of the render.

uint32_t udRenderContext_GetModelId(const struct udBlockRenderModel *pBlockRenderModel)

Get the unique user-defined id of the supplied model.

ParameterDescription
pBlockRenderModelThe model whose id will be returned

Returns: The unique id of the model.

uint32_t udRenderContext_GetVoxelShader(const struct udBlockRenderModel *pBlockRenderModel)

Get the voxel shader function pointer

ParameterDescription
pBlockRenderModelThe model whose voxel shader function will be returned

Returns: The voxel shader function of the model.

enum udError udRenderContext_LockBlock(void *pBlock)

Locks an Unlimited Detail block, preventing it from being freed by the streamer.

ParameterDescription
pBlockA pointer to an internal Unlimited Detail block.

Returns: A udError value indicating the result of the lock update.

enum udError udRenderContext_UnlockBlock(void *pBlock)

Unlocks an Unlimited Detail block, allowing the streamer to free it.

ParameterDescription
pBlockA pointer to an internal Unlimited Detail block.

Returns: A udError value indicating the result of the lock update.

Structs

struct udBlockRenderDrawList

Passed by the block renderer to the implementation to define what parts of the block need to be rendered

FieldTypeDescription
crcuint32_tA crc representing inputs to the drawlist (eg listMask or geometry), allowing callers to cache if necessary.
listMaskuint16_tWhen non-zero, the divisions the mask used to create the drawlist (with adjacent divisions merged), zero indicates non-merged/filtered list.
drawCountuint16_tNumber of drawcalls to complete this block.
draws[1]struct udBlockRenderDrawList::DrawCall

struct DrawCall

Stores the internal state of the draw call

FieldTypeDescription
startuint16_tStarting index in the vertex buffer.
countuint16_tNumber of points for this call.
maskuint16_tMask of division this call is relevant to (bitwise and with supplied divisionMask to determine draw/skip).

struct udBlockRenderVertexData

Stores the vertex data needed to render a block

FieldTypeDescription
pBlockvoid \*Pointer to internal block memory.
pPointBufferconst struct [udPointBufferU64](udPointBuffer.md) \*Pointer to points data.
unitOctreeMultiplierdoubleMultiplier to take from integer octee space to 0..1 octree space.
nodeSizedoubleGenerally the w component for the size of the node (1.0 == root, 0.5 = level 1, 0.25, etc).
childSizedoublenodeSize * 0.5 Currently legacy, with intent to switch everything to nodeSize
modelToBlockudDouble4x4Matrix to take a block from model space, to block space.
distEyedoubleDistance of this block to the camera (in eye space).

struct udBlockRenderModel

Exposes data required to render a model

FieldTypeDescription
pRenderModelstruct udRenderModel \*Pointer to internal model.
worldudDouble4x4World Matrix.
worldViewudDouble4x4World-View Matrix.
projectionudDouble4x4Projection Matrix.
wvpsudDouble4x4World-View-Projection-Screen Matrix.
frustumPlanes[6]udDouble4Cached view frustum planes.
eyePosMSudDouble3Position of the eye in model space.
cameraForwardudDouble3Forward vector of the camera in model space.
cameraFacingDiagudDouble3Vector that when transformed will be a diagonal line in screen space.

struct udBlockRenderInfo

Structure to hold rendering info for a single drawcall

FieldTypeDescription
pDrawListstruct udBlockRenderDrawList \*The draw list defining which points of the block are to be rendered.
blockPrioritydoubleThe priority of the block.
pointModeenum [udRenderContextPointMode](udRenderContext.md)points/rectangles/cubes
divisionsMaskuint16_tdivisions mask, identifying which portions of the block are to be rendered

struct udBlockRenderGPUInterface

Structure that stores user-defined rendering callbacks (optional and required)

FieldTypeDescription
height)void (\*pBeginRender)(void \*pGPUContext, const struct udRenderView \*pView, uint32_t width, uint32_tCalled when rendering begins.
pGPUContext)void (\*pEndRender)(void \*Called when rendering ends.
ppVertexBuffer)enum [udError](udError.md) (\*pCreateVertexBuffer)(void \*pGPUContext, const struct udBlockRenderModel \*pModel, const struct udBlockRenderVertexData vertexData, void \* \*Called when vertex buffer is ready to be created.
pVoxelShaderData)enum [udError](udError.md) (\*pUploadVertexBuffer)(void \*pGPUContext, const struct udBlockRenderModel \*pModel, void \*pVertexBuffer, void \*Called when vertex buffer is ready to upload to GPU.
pInfo)enum [udError](udError.md) (\*pRenderVertexBuffer)(void \*pGPUContext, const struct udBlockRenderModel \*pModel, void \*pVertexBuffer, void \*pVoxelShaderData, const struct udBlockRenderInfo \*Called when vertex buffer is to be rendered.
pVertexBuffer)enum [udError](udError.md) (\*pDestroyVertexBuffer)(void \*pGPUContext, void \*Called when vertex buffer is to be destroyed.
pGPUContextvoid \*Internal pointer to user-defined storage.