Photon Engine C API 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph_c_core.cpp File Reference
#include "ph_c_core.h"
#include "Api/api_helpers.h"
#include <ph_core.h>
#include <Api/ApiDatabase.h>
#include <Common/assertion.h>
#include <Common/config.h>
#include <Common/logging.h>
#include <Common/profiling.h>
#include <Common/memory.h>
#include <Core/Engine.h>
#include <Core/Receiver/Receiver.h>
#include <Core/Renderer/Renderer.h>
#include <Core/Renderer/RenderRegionStatus.h>
#include <Api/test_scene.h>
#include <Math/TArithmeticArray.h>
#include <DataIO/FileSystem/Path.h>
#include <DataIO/io_utils.h>
#include <Api/ApiHelper.h>
#include <Frame/frame_utils.h>
#include <Frame/TFrame.h>
#include <Frame/PictureMeta.h>
#include <Common/io_exceptions.h>
#include <Utility/ByteBuffer.h>
#include <Utility/utility.h>
#include <memory>
#include <iostream>
#include <cstring>
#include <cstddef>
#include <array>

Functions

 PH_DEFINE_INTERNAL_LOG_GROUP (CAPI, Engine)
 
void phConfigRendererResourceDirectory (const PhChar *const directory)
 
PhBool phInit ()
 
PhBool phExit ()
 
void phCreateEngine (PhUInt64 *const out_engineId, const PhUInt32 numRenderThreads)
 Creates an engine.
 
void phSetNumRenderThreads (const PhUInt64 engineId, const PhUInt32 numRenderThreads)
 
void phDeleteEngine (const PhUInt64 engineId)
 
void phEnterCommand (const PhUInt64 engineId, const PhChar *const commandFragment)
 
PhBool phLoadCommands (const PhUInt64 engineId, const PhChar *const filePath)
 
void phRender (const PhUInt64 engineId)
 
void phUpdate (const PhUInt64 engineId)
 
void phAquireFrame (const PhUInt64 engineId, const PhUInt64 channelIndex, const PhUInt64 frameId)
 
void phAquireFrameRaw (const PhUInt64 engineId, const PhUInt64 channelIndex, const PhUInt64 frameId)
 
void phGetRenderDimension (const PhUInt64 engineId, PhUInt32 *const out_widthPx, PhUInt32 *const out_heightPx)
 
void phGetObservableRenderData (const PhUInt64 engineId, struct PHObservableRenderData *const out_data)
 
void phCreateFrame (PhUInt64 *const out_frameId, const PhUInt32 widthPx, const PhUInt32 heightPx)
 
void phGetFrameDimension (const PhUInt64 frameId, PhUInt32 *const out_widthPx, PhUInt32 *const out_heightPx)
 
void phGetFrameRgbData (const PhUInt64 frameId, const PhFloat32 **const out_data)
 
void phDeleteFrame (const PhUInt64 frameId)
 
PhBool phLoadFrame (PhUInt64 frameId, const PhChar *const filePath)
 
PhBool phSaveFrame (const PhUInt64 frameId, const PhChar *filePath, const PhFrameSaveInfo *saveInfo)
 Save a frame to the filesystem.
 
PhBool phSaveFrameToBuffer (const PhUInt64 frameId, const PhUInt64 bufferId, const PhBufferFormat format, const PhFrameSaveInfo *saveInfo)
 Save a frame to a buffer.
 
void phFrameOpAbsDifference (const PhUInt64 frameAId, const PhUInt64 frameBId, const PhUInt64 resultFrameId)
 
PhFloat32 phFrameOpMSE (const PhUInt64 expectedFrameId, const PhUInt64 estimatedFrameId)
 
void phAsyncGetRenderProgress (PhUInt64 engineId, PhRenderProgress *out_progress)
 
void phAsyncGetRenderStatistics (const PhUInt64 engineId, PhFloat32 *const out_percentageProgress, PhFloat32 *const out_samplesPerSecond)
 
void phAsyncGetRenderState (const PhUInt64 engineId, struct PHRenderState *const out_state)
 
PhBool phAsyncPollUpdatedFrameRegion (PhUInt64 engineId, PhFrameRegionInfo *out_regionInfo)
 Polls for a single changed region during engine runtime.
 
PhSize phAsyncPollUpdatedFrameRegions (PhUInt64 engineId, PhUInt64 bufferId, PhFrameRegionInfo *out_regionInfos, PhSize maxRegionInfos)
 Polls for multiple changed regions during engine runtime.
 
PhSize phAsyncPollMergedUpdatedFrameRegions (PhUInt64 engineId, PhUInt64 bufferId, PhSize mergeSize, PhFrameRegionInfo *out_regionInfos, PhSize maxRegionInfos)
 Polls for multiple changed regions during engine runtime.
 
void phAsyncPeekFrame (PhUInt64 engineId, PhUInt64 layerIndex, PhUInt32 xPx, PhUInt32 yPx, PhUInt32 widthPx, PhUInt32 heightPx, PhUInt64 frameId)
 
void phAsyncPeekFrameRaw (PhUInt64 engineId, PhUInt64 layerIndex, PhUInt32 xPx, PhUInt32 yPx, PhUInt32 widthPx, PhUInt32 heightPx, PhUInt64 frameId)
 
void phSetWorkingDirectory (const PhUInt64 engineId, const PhChar *const workingDirectory)
 
void phCreateBuffer (PhUInt64 *const out_bufferId)
 
void phGetBufferBytes (const PhUInt64 bufferId, const PhUChar **const out_bytesPtr, PhSize *const out_numBytes)
 
void phDeleteBuffer (const PhUInt64 bufferId)
 

Function Documentation

◆ PH_DEFINE_INTERNAL_LOG_GROUP()

PH_DEFINE_INTERNAL_LOG_GROUP ( CAPI ,
Engine  )

◆ phAquireFrame()

void phAquireFrame ( const PhUInt64 engineId,
const PhUInt64 channelIndex,
const PhUInt64 frameId )

◆ phAquireFrameRaw()

void phAquireFrameRaw ( const PhUInt64 engineId,
const PhUInt64 channelIndex,
const PhUInt64 frameId )

◆ phAsyncGetRenderProgress()

void phAsyncGetRenderProgress ( PhUInt64 engineId,
PhRenderProgress * out_progress )

◆ phAsyncGetRenderState()

void phAsyncGetRenderState ( const PhUInt64 engineId,
struct PHRenderState *const out_state )

◆ phAsyncGetRenderStatistics()

void phAsyncGetRenderStatistics ( const PhUInt64 engineId,
PhFloat32 *const out_percentageProgress,
PhFloat32 *const out_samplesPerSecond )

◆ phAsyncPeekFrame()

void phAsyncPeekFrame ( PhUInt64 engineId,
PhUInt64 layerIndex,
PhUInt32 xPx,
PhUInt32 yPx,
PhUInt32 widthPx,
PhUInt32 heightPx,
PhUInt64 frameId )

◆ phAsyncPeekFrameRaw()

void phAsyncPeekFrameRaw ( PhUInt64 engineId,
PhUInt64 layerIndex,
PhUInt32 xPx,
PhUInt32 yPx,
PhUInt32 widthPx,
PhUInt32 heightPx,
PhUInt64 frameId )

◆ phAsyncPollMergedUpdatedFrameRegions()

PhSize phAsyncPollMergedUpdatedFrameRegions ( PhUInt64 engineId,
PhUInt64 bufferId,
PhSize mergeSize,
PhFrameRegionInfo * out_regionInfos,
PhSize maxRegionInfos )

Polls for multiple changed regions during engine runtime.

Parameters
out_regionInfosOutput buffer for storing the updated regions. The size of the buffer also determines the maximum number of regions that will participate in the merging process.
mergeSizeNumber of regions to merge to a single unit. To obtain a single region, you can specify a number greater or equal to the size of the output buffer.

◆ phAsyncPollUpdatedFrameRegion()

PhBool phAsyncPollUpdatedFrameRegion ( PhUInt64 engineId,
PhFrameRegionInfo * out_regionInfo )

Polls for a single changed region during engine runtime.

◆ phAsyncPollUpdatedFrameRegions()

PhSize phAsyncPollUpdatedFrameRegions ( PhUInt64 engineId,
PhUInt64 bufferId,
PhFrameRegionInfo * out_regionInfos,
PhSize maxRegionInfos )

Polls for multiple changed regions during engine runtime.

◆ phConfigRendererResourceDirectory()

void phConfigRendererResourceDirectory ( const PhChar *const directory)

◆ phCreateBuffer()

void phCreateBuffer ( PhUInt64 *const out_bufferId)

◆ phCreateEngine()

void phCreateEngine ( PhUInt64 *const out_engineId,
const PhUInt32 numRenderThreads )

Creates an engine.

◆ phCreateFrame()

void phCreateFrame ( PhUInt64 *const out_frameId,
const PhUInt32 widthPx,
const PhUInt32 heightPx )

◆ phDeleteBuffer()

void phDeleteBuffer ( const PhUInt64 bufferId)

◆ phDeleteEngine()

void phDeleteEngine ( const PhUInt64 engineId)

◆ phDeleteFrame()

void phDeleteFrame ( const PhUInt64 frameId)

◆ phEnterCommand()

void phEnterCommand ( const PhUInt64 engineId,
const PhChar *const commandFragment )

◆ phExit()

PhBool phExit ( )

◆ phFrameOpAbsDifference()

void phFrameOpAbsDifference ( const PhUInt64 frameAId,
const PhUInt64 frameBId,
const PhUInt64 resultFrameId )

◆ phFrameOpMSE()

PhFloat32 phFrameOpMSE ( const PhUInt64 expectedFrameId,
const PhUInt64 estimatedFrameId )

◆ phGetBufferBytes()

void phGetBufferBytes ( const PhUInt64 bufferId,
const PhUChar **const out_bytesPtr,
PhSize *const out_numBytes )

◆ phGetFrameDimension()

void phGetFrameDimension ( const PhUInt64 frameId,
PhUInt32 *const out_widthPx,
PhUInt32 *const out_heightPx )

◆ phGetFrameRgbData()

void phGetFrameRgbData ( const PhUInt64 frameId,
const PhFloat32 **const out_data )

◆ phGetObservableRenderData()

void phGetObservableRenderData ( const PhUInt64 engineId,
struct PHObservableRenderData *const out_data )

◆ phGetRenderDimension()

void phGetRenderDimension ( const PhUInt64 engineId,
PhUInt32 *const out_widthPx,
PhUInt32 *const out_heightPx )

◆ phInit()

PhBool phInit ( )

◆ phLoadCommands()

PhBool phLoadCommands ( const PhUInt64 engineId,
const PhChar *const filePath )

◆ phLoadFrame()

PhBool phLoadFrame ( PhUInt64 frameId,
const PhChar *const filePath )

◆ phRender()

void phRender ( const PhUInt64 engineId)

◆ phSaveFrame()

PhBool phSaveFrame ( const PhUInt64 frameId,
const PhChar * filePath,
const PhFrameSaveInfo * saveInfo )

Save a frame to the filesystem.

◆ phSaveFrameToBuffer()

PhBool phSaveFrameToBuffer ( PhUInt64 frameId,
PhUInt64 bufferId,
PhBufferFormat format,
const PhFrameSaveInfo * saveInfo )

Save a frame to a buffer.

Parameters
saveInBigEndianIf applicable to the format, specifies whether the result is saved in big endian. This is useful, for example, transferring the data through the Internet, where big-endian is the standard byte order.

◆ phSetNumRenderThreads()

void phSetNumRenderThreads ( const PhUInt64 engineId,
const PhUInt32 numRenderThreads )

◆ phSetWorkingDirectory()

void phSetWorkingDirectory ( const PhUInt64 engineId,
const PhChar *const workingDirectory )

◆ phUpdate()

void phUpdate ( const PhUInt64 engineId)