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

Function compile_spring_joint

src/resource/physics_resource.cpp:533–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531 }
532
533 s32 compile_spring_joint(Buffer &output, UnitCompiler &compiler, FlatJsonObject &obj, CompileOptions &opts)
534 {
535 SpringJoint spring = {};
536 JointDesc jd;
537 s32 err = joint_common_parse(jd, JointType::SPRING, compiler, obj, opts);
538 ENSURE_OR_RETURN(PHYSICS_RESOURCE, err == 0, opts);
539
540 spring.stiffness = RETURN_IF_ERROR(sjson::parse_float(flat_json_object::get(obj, "data.stiffness")));
541 spring.damping = RETURN_IF_ERROR(sjson::parse_float(flat_json_object::get(obj, "data.damping")));
542
543 FileBuffer fb(output);
544 err = joint_common_write(fb, jd);
545 ENSURE_OR_RETURN(PHYSICS_RESOURCE, err == 0, opts);
546
547 BinaryWriter bw(fb);
548 bw.write(spring.stiffness);
549 bw.write(spring.damping);
550 return 0;
551 }
552
553 s32 compile_d6_joint(Buffer &output, UnitCompiler &compiler, FlatJsonObject &obj, CompileOptions &opts)
554 {

Callers

nothing calls this directly

Calls 5

joint_common_parseFunction · 0.85
getFunction · 0.85
joint_common_writeFunction · 0.85
parse_floatFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected