Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::SdlCommandGenerator Class Referenceabstract

#include <SdlCommandGenerator.h>

Inheritance diagram for ph::SdlCommandGenerator:
ph::SdlSceneFileWriter

Public Member Functions

 SdlCommandGenerator (TSpanView< const SdlClass * > targetClasses)
 
 SdlCommandGenerator (TSpanView< const SdlClass * > targetClasses, const Path &sceneWorkingDirectory)
 
virtual ~SdlCommandGenerator ()
 
void generateResourceCommand (const ISdlResource *resource, std::string_view resourceName)
 
void generateCachedNamedDataPacketCommand (const SdlNamedOutputClauses &namedClauses)
 
void generateVersionCommand (const SemanticVersion &version)
 
void setPacketInterface (std::unique_ptr< SdlDataPacketInterface > interface)
 
void setSceneWorkingDirectory (const Path &directory)
 
SdlDataPacketInterfacegetPacketInterface ()
 
const PathgetSceneWorkingDirectory () const
 
std::size_t numGeneratedCommands () const
 
std::size_t numGenerationErrors () const
 
void clearStats ()
 
bool hasTarget (const SdlClass *clazz) const
 

Protected Member Functions

virtual bool beginCommand (const SdlClass *targetClass, SdlOutputContext *out_ctx)=0
 Called when the generator starts producing a command.
 
virtual void endCommand ()=0
 Called when the generator finishes producing a command. This is called last in the sequence of handler calls for a command. Will not be called on error or if the command is canceled (see beginCommand()).
 
virtual void saveResource (const ISdlResource *resource, const SdlOutputContext &ctx, SdlOutputClauses &clauses)=0
 Save target resource into output clauses.
 
virtual void commandGenerated (std::string_view commandStr, const SdlOutputContext &ctx)=0
 Called when one or more commands are generated.
 

Constructor & Destructor Documentation

◆ SdlCommandGenerator() [1/2]

ph::SdlCommandGenerator::SdlCommandGenerator ( TSpanView< const SdlClass * > targetClasses)
explicit

◆ SdlCommandGenerator() [2/2]

ph::SdlCommandGenerator::SdlCommandGenerator ( TSpanView< const SdlClass * > targetClasses,
const Path & sceneWorkingDirectory )

◆ ~SdlCommandGenerator()

ph::SdlCommandGenerator::~SdlCommandGenerator ( )
virtualdefault

Member Function Documentation

◆ beginCommand()

virtual bool ph::SdlCommandGenerator::beginCommand ( const SdlClass * targetClass,
SdlOutputContext * out_ctx )
protectedpure virtual

Called when the generator starts producing a command.

Parameters
[out]out_ctxStores the context for the command. This context will be used for subsequent handlers (saveResource(), commandGenerated(), commandGenerated()) for the same command.
Returns
Whether to generate command for this class. If false, this command will be skipped and endCommand() will not be called.

Implemented in ph::SdlSceneFileWriter.

◆ clearStats()

void ph::SdlCommandGenerator::clearStats ( )

◆ commandGenerated()

virtual void ph::SdlCommandGenerator::commandGenerated ( std::string_view commandStr,
const SdlOutputContext & ctx )
protectedpure virtual

Called when one or more commands are generated.

Parameters
commandStrThe newly generated command(s).
ctxContext for the command.

Implemented in ph::SdlSceneFileWriter.

◆ endCommand()

virtual void ph::SdlCommandGenerator::endCommand ( )
protectedpure virtual

Called when the generator finishes producing a command. This is called last in the sequence of handler calls for a command. Will not be called on error or if the command is canceled (see beginCommand()).

Implemented in ph::SdlSceneFileWriter.

◆ generateCachedNamedDataPacketCommand()

void ph::SdlCommandGenerator::generateCachedNamedDataPacketCommand ( const SdlNamedOutputClauses & namedClauses)

◆ generateResourceCommand()

void ph::SdlCommandGenerator::generateResourceCommand ( const ISdlResource * resource,
std::string_view resourceName )

◆ generateVersionCommand()

void ph::SdlCommandGenerator::generateVersionCommand ( const SemanticVersion & version)

◆ getPacketInterface()

SdlDataPacketInterface & ph::SdlCommandGenerator::getPacketInterface ( )

◆ getSceneWorkingDirectory()

const Path & ph::SdlCommandGenerator::getSceneWorkingDirectory ( ) const
inline

◆ hasTarget()

bool ph::SdlCommandGenerator::hasTarget ( const SdlClass * clazz) const

◆ numGeneratedCommands()

std::size_t ph::SdlCommandGenerator::numGeneratedCommands ( ) const
inline

◆ numGenerationErrors()

std::size_t ph::SdlCommandGenerator::numGenerationErrors ( ) const
inline

◆ saveResource()

virtual void ph::SdlCommandGenerator::saveResource ( const ISdlResource * resource,
const SdlOutputContext & ctx,
SdlOutputClauses & clauses )
protectedpure virtual

Save target resource into output clauses.

Parameters
resourceThe resource to save.
ctxContext for the command.
[out]clausesBuffer to append the generated clauses.

Implemented in ph::SdlSceneFileWriter.

◆ setPacketInterface()

void ph::SdlCommandGenerator::setPacketInterface ( std::unique_ptr< SdlDataPacketInterface > interface)

◆ setSceneWorkingDirectory()

void ph::SdlCommandGenerator::setSceneWorkingDirectory ( const Path & directory)

The documentation for this class was generated from the following files: