Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlSceneFileWriter.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <string>
9
10namespace ph
11{
12
13class SceneDescription;
14class FormattedTextOutputStream;
15
20{
21public:
23
26 SdlSceneFileWriter(const Path& sceneFile, const Path& sceneWorkingDirectory);
27
31 TSpanView<const SdlClass*> targetClasses,
32 const Path& sceneFile,
33 const Path& sceneWorkingDirectory);
34
37 void write(const SceneDescription& scene);
38
39 void setSceneFile(Path sceneFile);
40
41protected:
42 bool beginCommand(
43 const SdlClass* targetClass,
44 SdlOutputContext* out_ctx) override;
45
46 void endCommand() override;
47
48 void saveResource(
49 const ISdlResource* resource,
50 const SdlOutputContext& ctx,
51 SdlOutputClauses& clauses) override;
52
54 std::string_view commandStr,
55 const SdlOutputContext& ctx) override;
56
57private:
58 void saveSceneToFile(const SceneDescription& scene);
59
60 Path m_sceneFile;
61 SdlDependencyResolver m_resolver;
62 SdlNamedOutputClauses m_namedOutputClauses;
63 FormattedTextOutputStream* m_fileStream;
64};
65
66}// end namespace ph
Write text with basic auto formatting applied.
Definition FormattedTextOutputStream.h:17
Interface for all SDL resource.
Definition ISdlResource.h:22
General path representation. Does not check whether the target actually exists (e....
Definition Path.h:21
Data that describe a scene. Represents the result of running SDL commands.
Definition SceneDescription.h:14
Definition SdlClass.h:25
Definition SdlCommandGenerator.h:22
Resolves dependency between SDL resources and provides a valid initialization order....
Definition SdlDependencyResolver.h:21
Definition SdlNamedOutputClauses.h:18
Definition SdlOutputClauses.h:14
Data that SDL output process can rely on.
Definition SdlOutputContext.h:19
Saving utility for renderer scene. Writes .p2 (Photon-v2) file.
Definition SdlSceneFileWriter.h:20
void write(const SceneDescription &scene)
Writes the scene to the writer-specified destination.
Definition SdlSceneFileWriter.cpp:99
void endCommand() override
Called when the generator finishes producing a command. This is called last in the sequence of handle...
Definition SdlSceneFileWriter.cpp:60
void commandGenerated(std::string_view commandStr, const SdlOutputContext &ctx) override
Called when one or more commands are generated.
Definition SdlSceneFileWriter.cpp:87
void saveResource(const ISdlResource *resource, const SdlOutputContext &ctx, SdlOutputClauses &clauses) override
Save target resource into output clauses.
Definition SdlSceneFileWriter.cpp:63
bool beginCommand(const SdlClass *targetClass, SdlOutputContext *out_ctx) override
Called when the generator starts producing a command.
Definition SdlSceneFileWriter.cpp:47
SdlSceneFileWriter()
Definition SdlSceneFileWriter.cpp:23
void setSceneFile(Path sceneFile)
Definition SdlSceneFileWriter.cpp:114
The root for all renderer implementations.
Definition EEngineProject.h:6
std::span< const T, EXTENT > TSpanView
Same as TSpan, except that the objects are const-qualified. Note that for pointer types,...
Definition TSpan.h:19