34#ifdef WITH_CYCLES_STANDALONE_GUI
60 static int maxlen = 0;
64 for (
int i =
len; i < maxlen; i++) {
74 string status, substatus;
80 if (substatus !=
"") {
81 status +=
": " + substatus;
85 status =
string_printf(
"Progress %05.2f %s", (
double)progress * 100, status.c_str());
134#ifdef WITH_CYCLES_STANDALONE_GUI
149#ifdef WITH_CYCLES_STANDALONE_GUI
179#ifdef WITH_CYCLES_STANDALONE_GUI
180static void display_info(
Progress &progress)
182 static double latency = 0.0;
183 static double last = 0;
185 string str, interactive;
187 latency = (elapsed - last);
191 string status, substatus;
198 status +=
": " + substatus;
212 (
double)progress_val * 100,
214 interactive.c_str());
229static void motion(
int x,
int y,
int button)
241 else if (button == 2) {
258static void resize(
int width,
int height)
275static void keyboard(
unsigned char key)
290 else if (key ==
'p') {
300 else if (
options.
interactive && (key ==
'w' || key ==
'a' || key ==
's' || key ==
'd')) {
324 else if (
options.
interactive && (key ==
'0' || key ==
'1' || key ==
'2' || key ==
'3')) {
371 string device_names =
"";
372 string devicename =
"CPU";
378 if (device_names !=
"") {
379 device_names +=
", ";
386 string ssname =
"svm";
390 bool help =
false, profile =
false, debug =
false, version =
false;
393 ap.options(
"Usage: cycles [options] file.xml",
399 (
"Devices to use: " + device_names).c_str(),
403 "Shading system to use: svm, osl",
407 "Render in background, without user interface",
410 "In background mode, don't print progress messages",
413 "Number of samples to render",
416 "File path to write output image",
419 "CPU Rendering Threads",
422 "Window width in pixel",
425 "Window height in pixel",
428 "Tile size in pixels",
431 "List information about all available devices",
434 "Enable profile logging",
435#ifdef WITH_CYCLES_LOGGING
438 "Enable debug logging",
441 "Set verbosity of the logger",
445 "Print help message",
448 "Print version number",
451 if (ap.parse(argc, argv) < 0) {
452 fprintf(stderr,
"%s\n", ap.geterror().c_str());
486 if (ssname ==
"osl") {
489 else if (ssname ==
"svm") {
493#ifndef WITH_CYCLES_STANDALONE_GUI
505 bool device_available =
false;
506 if (!devices.empty()) {
508 device_available =
true;
513 fprintf(stderr,
"Unknown device: %s\n", devicename.c_str());
517 else if (!(ssname ==
"osl" || ssname ==
"svm")) {
518 fprintf(stderr,
"Unknown shading system: %s\n", ssname.c_str());
524 fprintf(stderr,
"OSL shading system only works with CPU device\n");
533 fprintf(stderr,
"No file path specified\n");
542int main(
int argc,
const char **argv)
548#ifdef WITH_CYCLES_STANDALONE_GUI
554#ifdef WITH_CYCLES_STANDALONE_GUI
static vector< DeviceInfo > available_devices(uint device_type_mask=DEVICE_MASK_ALL)
static DeviceType type_from_string(const char *name)
static vector< DeviceType > available_types()
static string string_from_type(DeviceType type)
void get_status(string &status_, string &substatus_) const
void set_cancel(const string &cancel_message_)
void get_time(double &total_time_, double &render_time_) const
double get_progress() const
void set_update_callback(function< void()> function)
ShadingSystem shadingsystem
void set_pause(bool pause)
void set_display_driver(unique_ptr< DisplayDriver > driver)
void reset(const SessionParams &session_params, const BufferParams &buffer_params)
void set_output_driver(unique_ptr< OutputDriver > driver)
static void session_init()
static BufferParams & session_buffer_params()
static void session_print_status()
static void session_exit()
static void options_parse(int argc, const char **argv)
CCL_NAMESPACE_BEGIN struct Options options
static void session_print(const string &str)
static int files_parse(int argc, const char *argv[])
void xml_read_file(Scene *scene, const char *filepath)
#define CCL_NAMESPACE_END
#define DEVICE_MASK(type)
CCL_NAMESPACE_BEGIN void util_logging_init(const char *argv0)
void util_logging_verbosity_set(int verbosity)
void util_logging_start()
VecBase< float, 4 > float4
string path_filename(const string &path)
void path_init(const string &path, const string &user_path)
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
bool string_endswith(const string_view s, const string_view end)
string string_to_lower(const string &s)
SessionParams session_params
T * create_node(Args &&...args)
CCL_NAMESPACE_BEGIN double time_dt()
#define CYCLES_VERSION_STRING
void window_main_loop(const char *title, int width, int height, WindowInitFunc initf, WindowExitFunc exitf, WindowResizeFunc resize, WindowDisplayFunc display, WindowKeyboardFunc keyboard, WindowMotionFunc motion)
void window_opengl_context_disable()
bool window_opengl_context_enable()
void window_display_info(const char *info)
void window_display_help()