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

Saving utility for renderer scene. Writes .p2 (Photon-v2) file. More...

#include <SdlSceneFileWriter.h>

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

Public Member Functions

 SdlSceneFileWriter ()
 
 SdlSceneFileWriter (const Path &sceneFile, const Path &sceneWorkingDirectory)
 Creates reader for all engine classes.
 
 SdlSceneFileWriter (TSpanView< const SdlClass * > targetClasses, const Path &sceneFile, const Path &sceneWorkingDirectory)
 Creates reader for a custom set of classes.
 
void write (const SceneDescription &scene)
 Writes the scene to the writer-specified destination.
 
void setSceneFile (Path sceneFile)
 
- Public Member Functions inherited from ph::SdlCommandGenerator
 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

bool beginCommand (const SdlClass *targetClass, SdlOutputContext *out_ctx) override
 Called when the generator starts producing a command.
 
void endCommand () override
 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()).
 
void saveResource (const ISdlResource *resource, const SdlOutputContext &ctx, SdlOutputClauses &clauses) override
 Save target resource into output clauses.
 
void commandGenerated (std::string_view commandStr, const SdlOutputContext &ctx) override
 Called when one or more commands are generated.
 

Detailed Description

Saving utility for renderer scene. Writes .p2 (Photon-v2) file.

Constructor & Destructor Documentation

◆ SdlSceneFileWriter() [1/3]

ph::SdlSceneFileWriter::SdlSceneFileWriter ( )

◆ SdlSceneFileWriter() [2/3]

ph::SdlSceneFileWriter::SdlSceneFileWriter ( const Path & sceneFile,
const Path & sceneWorkingDirectory )

Creates reader for all engine classes.

◆ SdlSceneFileWriter() [3/3]

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

Creates reader for a custom set of classes.

Member Function Documentation

◆ beginCommand()

bool ph::SdlSceneFileWriter::beginCommand ( const SdlClass * targetClass,
SdlOutputContext * out_ctx )
overrideprotectedvirtual

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.

Implements ph::SdlCommandGenerator.

◆ commandGenerated()

void ph::SdlSceneFileWriter::commandGenerated ( std::string_view commandStr,
const SdlOutputContext & ctx )
overrideprotectedvirtual

Called when one or more commands are generated.

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

Implements ph::SdlCommandGenerator.

◆ endCommand()

void ph::SdlSceneFileWriter::endCommand ( )
overrideprotectedvirtual

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()).

Implements ph::SdlCommandGenerator.

◆ saveResource()

void ph::SdlSceneFileWriter::saveResource ( const ISdlResource * resource,
const SdlOutputContext & ctx,
SdlOutputClauses & clauses )
overrideprotectedvirtual

Save target resource into output clauses.

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

Implements ph::SdlCommandGenerator.

◆ setSceneFile()

void ph::SdlSceneFileWriter::setSceneFile ( Path sceneFile)

◆ write()

void ph::SdlSceneFileWriter::write ( const SceneDescription & scene)

Writes the scene to the writer-specified destination.


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