void gltfWriter::AdditionalTechniqueParameters (FbxNode *pNode, web::json::value &techniqueParameters, bool bHasNormals /*=false*/) { if ( bHasNormals ) { techniqueParameters [U("normalMatrix")] =web::json::value::object ({ // normal matrix { U("semantic"), web::json::value::string (U("MODELVIEWINVERSETRANSPOSE")) }, { U("type"), web::json::value::number ((int)IOglTF::FLOAT_MAT3) } }) ; } techniqueParameters [U("modelViewMatrix")] =web::json::value::object ({ // modeliew matrix { U("semantic"), web::json::value::string (U("MODELVIEW")) }, { U("type"), web::json::value::number ((int)IOglTF::FLOAT_MAT4) } }) ; techniqueParameters [U("projectionMatrix")] =web::json::value::object ({ // projection matrix { U("semantic"), web::json::value::string (U("PROJECTION")) }, { U("type"), web::json::value::number ((int)IOglTF::FLOAT_MAT4) } }) ; //d:\projects\gltf\converter\collada2gltf\shaders\commonprofileshaders.cpp #905 //if ( hasSkinning ) { // addSemantic ("vs", "attribute", // "JOINT", "joint", 1, false); // addSemantic ("vs", "attribute", // "WEIGHT", "weight", 1, false); // assert (techniqueExtras != nullptr); // addSemantic ("vs", "uniform", // JOINTMATRIX, "jointMat", jointsCount, false, true /* force as an array */); //} // We ignore lighting if the only light we have is ambient int lightCount =pNode->GetScene ()->RootProperty.GetSrcObjectCount<FbxLight> () ; for ( int i =0 ; i < lightCount ; i++ ) { FbxLight *pLight =pNode->GetScene ()->RootProperty.GetSrcObject<FbxLight> (i) ; if ( lightCount == 1 && pLight->LightType.Get () == FbxLight::EType::ePoint ) return ; //utility::string_t name =nodeId (pLight->GetNode ()) ; utility::string_t name =utility::conversions::to_string_t (pLight->GetTypeName ()) ; std::transform (name.begin (), name.end (), name.begin (), ::tolower) ; if ( pLight->LightType.Get () == FbxLight::EType::ePoint ) { techniqueParameters [name + utility::conversions::to_string_t (i) + U("Color")] =web::json::value::object ({ // Color { U("type"), web::json::value::number ((int)IOglTF::FLOAT_VEC3) }, { U("value"), web::json::value::array ({{ pLight->Color.Get () [0], pLight->Color.Get () [1], pLight->Color.Get () [2] }}) } }) ; } else { techniqueParameters [name + utility::conversions::to_string_t (i) + U("Color")] =web::json::value::object ({ // Color { U("type"), web::json::value::number ((int)IOglTF::FLOAT_VEC3) }, { U("value"), web::json::value::array ({{ pLight->Color.Get () [0], pLight->Color.Get () [1], pLight->Color.Get () [2] }}) } }) ; techniqueParameters [name + utility::conversions::to_string_t (i) + U("Transform")] =web::json::value::object ({ // Transform { U("semantic"), web::json::value::string (U("MODELVIEW")) }, { U("source"), web::json::value::string (utility::conversions::to_string_t (pLight->GetNode ()->GetName ())) }, { U("type"), web::json::value::number ((int)IOglTF::FLOAT_MAT4) } }) ; if ( pLight->LightType.Get () == FbxLight::EType::eDirectional ) { web::json::value lightDef =web::json::value::object () ; lightAttenuation (pLight, lightDef) ; if ( !lightDef [U("constantAttenuation")].is_null () ) techniqueParameters [name + utility::conversions::to_string_t (i) + U("ConstantAttenuation")] =web::json::value::object ({ { U("type"), web::json::value::number ((int)IOglTF::FLOAT) }, { U("value"), lightDef [U("constantAttenuation")] } }) ; if ( !lightDef [U("linearAttenuation")].is_null () ) techniqueParameters [name + utility::conversions::to_string_t (i) + U("LinearAttenuation")] =web::json::value::object ({ { U("type"), web::json::value::number ((int)IOglTF::FLOAT) }, { U("value"), lightDef [U("linearAttenuation")] } }) ; if ( !lightDef [U("quadraticAttenuation")].is_null () ) techniqueParameters [name + utility::conversions::to_string_t (i) + U("QuadraticAttenuation")] =web::json::value::object ({ { U("type"), web::json::value::number ((int)IOglTF::FLOAT) }, { U("value"), lightDef [U("quadraticAttenuation")] } }) ; } if ( pLight->LightType.Get () == FbxLight::EType::eSpot ) { techniqueParameters [name + utility::conversions::to_string_t (i) + U("InverseTransform")] =web::json::value::object ({ { U("semantic"), web::json::value::string (U("MODELVIEWINVERSE")) }, { U("source"), web::json::value::string (utility::conversions::to_string_t (pLight->GetNode ()->GetName ())) }, { U("type"), web::json::value::number ((int)IOglTF::FLOAT_MAT4) } }) ; techniqueParameters [name + utility::conversions::to_string_t (i) + U("FallOffAngle")] =web::json::value::object ({ { U("type"), web::json::value::number ((int)IOglTF::FLOAT) }, { U("value"), web::json::value::number (DEG2RAD (pLight->OuterAngle)) } }) ; techniqueParameters [name + utility::conversions::to_string_t (i) + U("FallOffExponent")] =web::json::value::object ({ { U("type"), web::json::value::number ((int)IOglTF::FLOAT) }, { U("value"), web::json::value::number ((double)0.) } }) ; } } } }