μλ₯Ό λ€μ΄ renderer::FrameWriter
λ° renderer::FrameArchiver
.
λλ μ΄κ²μ λν΄ μΌν κ²μ΄λ€
μ κ·Έλ κ² ν΄μΌ ν©λκΉ? μ΄ λ ν΄λμ€μ μλλ 무μμ λκΉ? κ·Έλ₯ κΆκΈν©λλ€.
μλλ : νλ₯ν΄!
Dorian: κ·Έκ²μ λ¨μ§ 리ν©ν λ§μΌ λΏμ
λλ€. μ΄λ―Έμ§ μμ± μ½λλ renderer::Frame
μν°ν°μ ꡬνμ λ§μ νΌλμ μΆκ°ν©λλ€.
μμμ΄ κ³ λ§μ! :)
λκ΅°κ°μ΄ μμ μ μμ νμ΅λκΉ? λ΄κ° ν΄λ³Ό μ μμκΉ?
κΈμ, AndrΓ©λ μ΄λ―Έ κ·Έκ²μ μλ κ² κ°μ΅λλ€. AndrΓ©, μμ§ μμ μ€μΈκ°μ?
λ€, μ£Όλ§μ λ°λΉ μ μ£μ‘ν©λλ€λ§ ν΄λ³΄κ² μ΅λλ€!
μ΄μ λν μ ν΄λμ€λ₯Ό μ 곡ν μ μμ΅λκΉ? μ½λμ μΌλΆλ₯Ό μ΄ν΄νλ λ° λ¬Έμ κ° μμΌλ©° μ΄μ λν λ¬Έμλ₯Ό μ°Ύμ μ μμ΅λλ€. μ΄κ²μ 무μμ ν©λκΉ:
namespace
{
const UniqueID g_class_uid = new_guid();
}
UniqueID Frame::get_class_uid()
{
return g_class_uid;
}
λ΄κ° μ΄κ²μ μ¬λ°λ₯΄κ² μ»λλ€λ©΄ λλμ΄ κΈ°λ₯μ μ΄λν κ²μ λλ€ :
bool Frame::archive(
const char* directory,
char** output_path) const
{
assert(directory);
// Construct the name of the image file.
const string filename =
"autosave." + get_time_stamp_string() + ".exr";
// Construct the path to the image file.
const string file_path = (filesystem::path(directory) / filename).string();
// Return the path to the image file.
if (output_path)
*output_path = duplicate_string(file_path.c_str());
Image transformed_image(*impl->m_image);
transform_to_output_color_space(transformed_image);
return
write_image(
file_path.c_str(),
transformed_image,
ImageAttributes::create_default_attributes());
}
FrameWriter
ν΄λμ€λ‘. ν΄λμ€ μμ±μ μμνλ λ°©λ²μ μ λͺ¨λ₯΄κ² μ΅λλ€. λ€μκ³Ό κ°μ΄ νμλμ΄μΌ ν©λλ€.
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//includes
//using namespaces
namespace renderer
{
FrameArchiver::archive(...)
{
//code from Frame::archive
}
} // namespace renderer
κ°μ¬ν©λλ€. νλ‘κ·Έλλ°μ μμνλ €λ©΄ ν₯μ€ννΈκ° νμν©λλ€.
λ€, κΈ°λ³Έμ μΌλ‘ κ·Έλ μ΅λλ€. λ κ°μ μ νμΌ μ( framewriter.{h,cpp}
λ° framearchiver.{h,cpp}
) λλ ν μ( framewriter.{h,cpp}
)μ΄ μΆ©λΆνλ€κ³ μκ°λλ©΄ νμΌμ μΆκ°ν΄μΌ ν©λλ€. CMakeLists.txt νμΌμ λ§λ€κ³ μ½λλ₯Ό μ΄ μ νμΌλ‘ μ΄λν©λλ€.
μ§κΈ:
namespace
{
const UniqueID g_class_uid = new_guid();
}
μ΄λ κ² νλ©΄ μ΄ νμΌμ λ‘μ»¬μΈ μ κ³ μ IDκ° μμ±λ©λλ€. μ΄ IDλ "νλ μ" μν°ν° ν΄λμ€λ₯Ό κ³ μ νκ² μλ³νλ λ° μ¬μ©λ©λλ€. "Frame" ν΄λμ€μ ν΄λΉνλ ν΄λμ€ IDλ λ€μ μ μ λ©μλλ₯Ό ν΅ν΄ μ‘μΈμ€ν μ μμ΅λλ€.
UniqueID Frame::get_class_uid()
{
return g_class_uid;
}
FrameWriter
ν΄λμ€λ μν°ν° ν΄λμ€κ° μλλΌ μΌλ° ν΄λμ€μ΄λ―λ‘ μ΄ μ€ μ΄λ κ²λ νμνμ§ μμ΅λλ€.
μ΄ λ¬Έμ λ λ€μ μ¬μ©ν μ μμ΅λλ€.