MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / parseCamera

Function parseCamera

Source/ThirdParty/OpenFBX/ofbx.cpp:2451–2525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2449}
2450
2451struct OptionalError<Object*> parseCamera(Scene& scene, const Element& element, Allocator& allocator)
2452{
2453 CameraImpl* camera = allocator.allocate<CameraImpl>(scene, element);
2454
2455 camera->projectionType = static_cast<Camera::ProjectionType>(resolveEnumProperty(*camera, "ProjectionType", (int)Camera::ProjectionType::PERSPECTIVE));
2456 camera->apertureMode = static_cast<Camera::ApertureMode>(resolveEnumProperty(*camera, "ApertureMode", (int)Camera::ApertureMode::HORIZANDVERT));
2457 camera->gateFit = static_cast<Camera::GateFit>(resolveEnumProperty(*camera, "GateFit", (int)Camera::GateFit::HORIZONTAL));
2458
2459 const Element* prop = findChild(element, "Properties70");
2460 if (prop) prop = prop->child;
2461
2462 while (prop)
2463 {
2464 if (prop->id == "P" && prop->first_property)
2465 {
2466 if (prop->first_property->value == "InterestPosition")
2467 {
2468 camera->interestPosition.x = (float)prop->getProperty(4)->getValue().toDouble();
2469 camera->interestPosition.y = (float)prop->getProperty(5)->getValue().toDouble();
2470 camera->interestPosition.z = (float)prop->getProperty(6)->getValue().toDouble();
2471 }
2472 else if (prop->first_property->value == "BackgroundColor")
2473 {
2474 camera->backgroundColor.x = (float)prop->getProperty(4)->getValue().toDouble();
2475 camera->backgroundColor.y = (float)prop->getProperty(5)->getValue().toDouble();
2476 camera->backgroundColor.z = (float)prop->getProperty(6)->getValue().toDouble();
2477 }
2478 else if (prop->first_property->value == "FocalLength")
2479 {
2480 camera->focalLength = prop->getProperty(4)->getValue().toDouble();
2481 }
2482 else if (prop->first_property->value == "FocusDistance")
2483 {
2484 camera->focusDistance = prop->getProperty(4)->getValue().toDouble();
2485 }
2486 else if (prop->first_property->value == "FilmAspectRatio")
2487 {
2488 camera->filmAspectRatio = prop->getProperty(4)->getValue().toDouble();
2489 }
2490 else if (prop->first_property->value == "FilmWidth")
2491 {
2492 camera->filmWidth = prop->getProperty(4)->getValue().toDouble();
2493 }
2494 else if (prop->first_property->value == "FilmHeight")
2495 {
2496 camera->filmHeight = prop->getProperty(4)->getValue().toDouble();
2497 }
2498 else if (prop->first_property->value == "AspectHeight")
2499 {
2500 camera->aspectHeight = prop->getProperty(4)->getValue().toDouble();
2501 }
2502 else if (prop->first_property->value == "AspectWidth")
2503 {
2504 camera->aspectWidth = prop->getProperty(4)->getValue().toDouble();
2505 }
2506 else if (prop->first_property->value == "AutoComputeClipPanes")
2507 {
2508 camera->autoComputeClipPanes = prop->getProperty(4)->getValue().toBool();

Callers 1

parseObjectsFunction · 0.85

Calls 8

resolveEnumPropertyFunction · 0.85
findChildFunction · 0.85
toDoubleMethod · 0.80
getPropertyMethod · 0.80
toBoolMethod · 0.80
CalculateFOVMethod · 0.80
getValueMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected