static void ReadLight()

in src/fbx/Fbx2Raw.cpp [483:517]


static void ReadLight(RawModel& raw, FbxScene* pScene, FbxNode* pNode) {
  const FbxLight* pLight = pNode->GetLight();

  int lightIx;
  float intensity = (float)pLight->Intensity.Get();
  Vec3f color = toVec3f(pLight->Color.Get());
  switch (pLight->LightType.Get()) {
    case FbxLight::eDirectional: {
      lightIx = raw.AddLight(pLight->GetName(), RAW_LIGHT_TYPE_DIRECTIONAL, color, intensity, 0, 0);
      break;
    }
    case FbxLight::ePoint: {
      lightIx = raw.AddLight(pLight->GetName(), RAW_LIGHT_TYPE_POINT, color, intensity, 0, 0);
      break;
    }
    case FbxLight::eSpot: {
      lightIx = raw.AddLight(
          pLight->GetName(),
          RAW_LIGHT_TYPE_SPOT,
          color,
          intensity,
          (float)pLight->InnerAngle.Get() * M_PI / 180,
          (float)pLight->OuterAngle.Get() * M_PI / 180);
      break;
    }
    default: {
      fmt::printf("Warning:: Ignoring unsupported light type.\n");
      return;
    }
  }

  int nodeId = raw.GetNodeById(pNode->GetUniqueID());
  RawNode& node = raw.GetNode(nodeId);
  node.lightIx = lightIx;
}