MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / SetFromDesc

Method SetFromDesc

Source/Objects/lightprobeobject.cpp:91–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91bool LightProbeObject::SetFromDesc(const EntityDescription& desc) {
92 LOG_ASSERT(probe_id_ == -1);
93 LOG_ASSERT(!stored_coefficients);
94 bool ret = Object::SetFromDesc(desc);
95 if (ret) {
96 for (const auto& field : desc.fields) {
97 switch (field.type) {
98 case EDF_NEGATIVE_LIGHT_PROBE: {
99 int negative_int;
100 field.ReadInt(&negative_int);
101 sp.ASAddIntCheckbox("Negative", false);
102 sp.ASSetInt("Negative", negative_int);
103 break;
104 }
105
106 case EDF_GI_COEFFICIENTS: {
107 LOG_ASSERT(!stored_coefficients);
108 stored_coefficients = new float[kLightProbeNumCoeffs];
109 memcpy(stored_coefficients, &field.data[0], kLightProbeNumCoeffs * sizeof(float));
110 break;
111 }
112 }
113 }
114 }
115
116 return ret;
117}

Callers

nothing calls this directly

Calls 3

ASAddIntCheckboxMethod · 0.80
ASSetIntMethod · 0.80
ReadIntMethod · 0.45

Tested by

no test coverage detected