MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / exportShadowParameters

Method exportShadowParameters

COLLADAMax/src/COLLADAMaxLightExporter.cpp:404–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402
403
404 void LightExporter::exportShadowParameters(GenLight* light)
405 {
406 // Export light shadow attributes
407 if (light->GetShadow())
408 {
409 // Light casts shadows
410 int shadowType = light->GetShadowType();
411 if (shadowType == 0) {
412 addExtraChildParameter(SHADOW_ATTRIBS, SHADOW_TYPE, SHADOW_TYPE_MAP);
413 int size = light->GetShadowGenerator()->GetMapSize(0);
414 addExtraChildParameter(SHADOW_ATTRIBS, SHADOW_SIZE, size);
415 }
416 else if (shadowType == 1)
417 addExtraChildParameter(SHADOW_ATTRIBS, SHADOW_TYPE, SHADOW_TYPE_RAYTRACE);
418
419 // GetExclusion list
420 ExclList& exclusions = light->GetExclusionList();
421 int exclusionsCount = exclusions.Count();
422 if (exclusionsCount > 0)
423 {
424 String nodeURIs;
425 for (int i = 0; i < exclusionsCount; i++)
426 {
427 INode* affectedNode = exclusions[i];
428 if ( !affectedNode )
429 continue;
430
431 if ( !nodeURIs.empty() )
432 nodeURIs += " ";
433
434 ExportNode* affectedExportNode = mExportSceneGraph->getExportNode(affectedNode);
435 String nodeURI = '#' + VisualSceneExporter::getNodeId(*affectedExportNode);
436 nodeURIs += nodeURI;
437 }
438 addExtraChildParameter(SHADOW_ATTRIBS, SHADOW_AFFECTS_LIST_NODES, nodeURIs);
439
440 if (!exclusions.TestFlag(NT_INCLUDE))
441 {
442 addExtraChildParameter(SHADOW_ATTRIBS, SHADOW_AFFECTS_LIST_EXCLUDES, 1);
443 }
444 if (exclusions.TestFlag(NT_AFFECT_ILLUM))
445 {
446 addExtraChildParameter(SHADOW_ATTRIBS, SHADOW_AFFECTS_LIST_ILLUMINATES, 1);
447 }
448 if (exclusions.TestFlag(NT_AFFECT_SHADOWCAST))
449 {
450 addExtraChildParameter(SHADOW_ATTRIBS, SHADOW_AFFECTS_LIST_CASTS, 1);
451 }
452 }
453
454 // Export our shadow projection map
455 Texmap* shadowProj = light->GetShadowProjMap();
456 if (shadowProj)
457 {
458 IParamBlock* pblock = (IParamBlock*)light->GetReference(MaxLight::PBLOCK_REF);
459 int shadowProjectionOn;
460 pblock->GetValue(MaxLight::PB_OMNISHAD_COLMAP, 0, shadowProjectionOn, Interval::FOREVER);
461 if (shadowProjectionOn)

Callers

nothing calls this directly

Calls 3

getExportNodeMethod · 0.80
getAnimationStartMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected