MCPcopy Create free account
hub / github.com/crownengine/crown / parse_physics

Function parse_physics

src/device/boot_config.cpp:56–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56static void parse_physics(PhysicsSettings *settings, const char *json)
57{
58 TempAllocator1024 ta;
59 JsonObject obj(ta);
60 sjson::parse(obj, json);
61
62 auto cur = json_object::begin(obj);
63 auto end = json_object::end(obj);
64 for (; cur != end; ++cur) {
65 JSON_OBJECT_SKIP_HOLE(obj, cur);
66
67 if (cur->first == "step_frequency") {
68 settings->step_frequency = sjson::parse_int(cur->second);
69 } else if (cur->first == "max_substeps") {
70 settings->max_substeps = sjson::parse_int(cur->second);
71 } else if (cur->first == "solver_iterations") {
72 settings->solver_iterations = sjson::parse_int(cur->second);
73 } else if (cur->first == "sleep_threshold") {
74 settings->sleep_threshold = sjson::parse_float(cur->second);
75 } else {
76 logw(BOOT_CONFIG
77 , "Unknown physics property '%.*s'"
78 , cur->first.length()
79 , cur->first.data()
80 );
81 }
82 }
83}
84
85static void parse_renderer_settings(BootConfig *config, const char *json)
86{

Callers 1

parseMethod · 0.85

Calls 7

parseFunction · 0.50
beginFunction · 0.50
endFunction · 0.50
parse_intFunction · 0.50
parse_floatFunction · 0.50
lengthMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected