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

Function parse_output

src/resource/texture_resource.cpp:150–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 };
149
150 s32 parse_output(OutputSettings &os, JsonObject &output, CompileOptions &opts)
151 {
152 const char *platform = opts.platform_name();
153
154 if (json_object::has(output, platform)) {
155 TempAllocator1024 ta;
156 JsonObject obj(ta);
157 RETURN_IF_ERROR(sjson::parse_object(obj, output[platform]));
158
159 DynamicString format(ta);
160 if (json_object::has(obj, "format")) {
161 RETURN_IF_ERROR(sjson::parse_string(format, obj["format"]));
162 os.format = texture_format_to_enum(format.c_str());
163 RETURN_IF_FALSE(TEXTURE_RESOURCE, os.format != TextureFormat::COUNT
164 , opts
165 , "Unknown texture format: '%s'"
166 , format.c_str()
167 );
168 }
169 if (json_object::has(obj, "generate_mips")) {
170 os.generate_mips = RETURN_IF_ERROR(sjson::parse_bool(obj["generate_mips"]));
171 }
172 if (json_object::has(obj, "mip_skip_smallest")) {
173 os.mip_skip_smallest = RETURN_IF_ERROR(sjson::parse_int (obj["mip_skip_smallest"]));
174 }
175 if (json_object::has(obj, "normal_map")) {
176 os.normal_map = RETURN_IF_ERROR(sjson::parse_bool(obj["normal_map"]));
177 }
178 if (json_object::has(obj, "linear")) {
179 os.linear = RETURN_IF_ERROR(sjson::parse_bool(obj["linear"]));
180 }
181 if (json_object::has(obj, "premultiply_alpha")) {
182 os.premultiply_alpha = RETURN_IF_ERROR(sjson::parse_bool(obj["premultiply_alpha"]));
183 }
184 }
185
186 return 0;
187 }
188
189 s32 compile(CompileOptions &opts)
190 {

Callers 1

compileFunction · 0.85

Calls 8

texture_format_to_enumFunction · 0.85
platform_nameMethod · 0.80
hasFunction · 0.50
parse_objectFunction · 0.50
parse_stringFunction · 0.50
parse_boolFunction · 0.50
parse_intFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected