Photon Engine 2.0.0-beta
A physically based renderer.
|
Loading utility for renderer scene. Loads .p2 (Photon-v2) file. More...
#include <SdlSceneFileReader.h>
Public Member Functions | |
SdlSceneFileReader () | |
SdlSceneFileReader (const Path &sceneFile, const Path &sceneWorkingDirectory) | |
Creates reader for all engine classes. | |
SdlSceneFileReader (TSpanView< const SdlClass * > targetClasses, const Path &sceneFile, const Path &sceneWorkingDirectory) | |
Creates reader for a custom set of classes. | |
~SdlSceneFileReader () override | |
void | read (SceneDescription *scene=nullptr) |
void | setSceneFile (Path sceneFile) |
void | setScene (SceneDescription *scene) |
Public Member Functions inherited from ph::SdlCommandParser | |
SdlCommandParser (TSpanView< const SdlClass * > targetClasses) | |
SdlCommandParser (TSpanView< const SdlClass * > targetClasses, const Path &sceneWorkingDirectory) | |
virtual | ~SdlCommandParser () |
void | parse (std::string_view rawCommandSegment) |
Enters a string and parse it as one or more commands. | |
void | flush () |
Force the parse of commands that were cached in the parser. | |
void | setPacketInterface (std::unique_ptr< SdlDataPacketInterface > interface) |
void | setSceneWorkingDirectory (const Path &directory) |
SdlDataPacketInterface & | getPacketInterface () |
const Path & | getSceneWorkingDirectory () const |
const SemanticVersion & | getCommandVersion () const |
std::size_t | numParsedCommands () const |
std::size_t | numParseErrors () const |
Protected Member Functions | |
bool | beginCommand (ESdlCommandType commandType, const SdlClass *targetClass, SdlInputContext *out_ctx) override |
Called when the parser starts processing a command. | |
void | endCommand () override |
Called when the parser finishes processing a command. | |
ISdlResource * | createResource (std::string_view resourceName, const SdlInputContext &ctx, ESdlCommandType commandType) override |
void | initResource (std::string_view resourceName, ISdlResource *resource, const SdlInputContext &ctx, SdlInputClauses &clauses, ESdlCommandType commandType) override |
ISdlResource * | getResource (std::string_view resourceName, const SdlInputContext &ctx) override |
void | runExecutor (std::string_view executorName, const SdlInputContext &ctx, ISdlResource *targetResource, SdlInputClauses &clauses, ESdlCommandType commandType) override |
Called when an executor command has been processed and is ready to run. | |
void | commandVersionSet (const SemanticVersion &version, const SdlInputContext &ctx) override |
void | storeNamedDataPacket (std::string_view packetName, const SdlInputClauses &packet, const SdlInputContext &ctx) override |
Loading utility for renderer scene. Loads .p2 (Photon-v2) file.
ph::SdlSceneFileReader::SdlSceneFileReader | ( | ) |
ph::SdlSceneFileReader::SdlSceneFileReader | ( | const Path & | sceneFile, |
const Path & | sceneWorkingDirectory ) |
Creates reader for all engine classes.
ph::SdlSceneFileReader::SdlSceneFileReader | ( | TSpanView< const SdlClass * > | targetClasses, |
const Path & | sceneFile, | ||
const Path & | sceneWorkingDirectory ) |
Creates reader for a custom set of classes.
|
overridedefault |
|
overrideprotectedvirtual |
Called when the parser starts processing a command.
Implements ph::SdlCommandParser.
|
overrideprotectedvirtual |
Implements ph::SdlCommandParser.
|
overrideprotectedvirtual |
Implements ph::SdlCommandParser.
|
overrideprotectedvirtual |
Called when the parser finishes processing a command.
Implements ph::SdlCommandParser.
|
overrideprotectedvirtual |
Implements ph::SdlCommandParser.
|
overrideprotectedvirtual |
Implements ph::SdlCommandParser.
void ph::SdlSceneFileReader::read | ( | SceneDescription * | scene = nullptr | ) |
[in,out] | scene | The target for parsed results. Effectively set current scene to scene then start reading. If scene was null, read to the current scene instead. |
|
overrideprotectedvirtual |
Called when an executor command has been processed and is ready to run.
A side note for SDL grammer: An executor may be called with an explicit class type, or with the type part omitted and let the class type deduced from the reference. Calling with explicit class type has potential performance benefit as the parser may not need to search the full class hierarchy to find the target executor to call (deducing from the reference itself always yield the exact, most derived type); however, calling with explicit class type may miss the derived implementation if the executor is overridden (the parser will only search from the class type you specified).
For implementations, obtaining the target class from context object should be preferred over obtaining from the resource itself, since an executor may be called with an explicit class and context object has this information.
Implements ph::SdlCommandParser.
void ph::SdlSceneFileReader::setScene | ( | SceneDescription * | scene | ) |
The reader takes a pointer to scene and cache it since a possible use case is to treat the reader as a command interpreter. Not specifying a scene on each method call makes a cleaner interface.
[in,out] | scene | The target for parsed results. scene will be the current scene. |
void ph::SdlSceneFileReader::setSceneFile | ( | Path | sceneFile | ) |
|
overrideprotectedvirtual |
Implements ph::SdlCommandParser.