From Alessandro Terenzi: modifications for supporting opacity, reflective and emissive maps beyond the already supported diffuse map in the FBX plugin.

A problem with transparency has also been fixed: objects were transparent wrt themselves but were opaque wrt to other objects.
Finally I added the support for "mixing factors" of diffuse, reflective and opacity textures/values.

From Michael Platings: added "LightmapTextures" plugin option that changes the way textures are interpreted so Alessandro's models appear correctly. Also refactored to put many functions in one class to avoid passing around too many arguments to functions.
This commit is contained in:
Michael PLATINGS
2010-06-04 19:50:32 +00:00
parent af3bc7903e
commit 359b6b480d
16 changed files with 547 additions and 199 deletions

View File

@@ -25,12 +25,7 @@
#endif
#include <fbxsdk.h>
#include "fbxRAnimation.h"
#include "fbxRCamera.h"
#include "fbxRLight.h"
#include "fbxRMesh.h"
#include "fbxRNode.h"
#include "fbxMaterialToOsgStateSet.h"
#include "fbxReader.h"
osg::Quat makeQuat(const fbxDouble3& degrees, ERotationOrder fbxRotOrder)
{
@@ -317,18 +312,9 @@ osg::Group* createGroupNode(KFbxSdkManager& pSdkManager, KFbxNode* pNode,
}
}
osgDB::ReaderWriter::ReadResult readFbxNode(
KFbxSdkManager& pSdkManager,
KFbxScene& fbxScene,
osgDB::ReaderWriter::ReadResult OsgFbxReader::readFbxNode(
KFbxNode* pNode,
osg::ref_ptr<osgAnimation::AnimationManagerBase>& pAnimationManager,
bool& bIsBone, int& nLightCount,
FbxMaterialToOsgStateSet& fbxMaterialToOsgStateSet,
std::map<KFbxNode*, osg::Node*>& nodeMap,
BindMatrixMap& boneBindMatrices,
const std::set<const KFbxNode*>& fbxSkeletons,
std::map<KFbxNode*, osgAnimation::Skeleton*>& skeletonMap,
const osgDB::Options& options)
bool& bIsBone, int& nLightCount)
{
if (KFbxNodeAttribute* lNodeAttribute = pNode->GetNodeAttribute())
{
@@ -383,9 +369,7 @@ osgDB::ReaderWriter::ReadResult readFbxNode(
bool bChildIsBone = false;
osgDB::ReaderWriter::ReadResult childResult = readFbxNode(
pSdkManager, fbxScene, pChildNode, pAnimationManager,
bChildIsBone, nLightCount, fbxMaterialToOsgStateSet, nodeMap,
boneBindMatrices, fbxSkeletons, skeletonMap, options);
pChildNode, bChildIsBone, nLightCount);
if (childResult.error())
{
return childResult;
@@ -404,7 +388,7 @@ osgDB::ReaderWriter::ReadResult readFbxNode(
}
}
std::string animName = readFbxAnimation(pNode, fbxScene, pAnimationManager, pNode->GetName());
std::string animName = readFbxAnimation(pNode, pNode->GetName());
osg::Matrix localMatrix;
makeLocalMatrix(pNode, localMatrix);
@@ -419,9 +403,7 @@ osgDB::ReaderWriter::ReadResult readFbxNode(
case KFbxNodeAttribute::eMESH:
{
size_t bindMatrixCount = boneBindMatrices.size();
osgDB::ReaderWriter::ReadResult meshRes = readFbxMesh(pSdkManager, fbxScene,
pNode, pAnimationManager, stateSetList, boneBindMatrices,
fbxSkeletons, skeletonMap, options);
osgDB::ReaderWriter::ReadResult meshRes = readFbxMesh(pNode, stateSetList);
if (meshRes.error())
{
return meshRes;
@@ -485,7 +467,7 @@ osgDB::ReaderWriter::ReadResult readFbxNode(
osg::Group* pAddChildrenTo = osgGroup.get();
if (bCreateSkeleton)
{
{
osgAnimation::Skeleton* osgSkeleton = getSkeleton(pNode, fbxSkeletons, skeletonMap);
osgSkeleton->setDefaultUpdateCallback();
pAddChildrenTo->addChild(osgSkeleton);