Splatmapping now working.

Rendering pipleline now support 3 different types of Material:
Basic: a material with a single color on every property (diffuse, specular, ect).
SingleTextures: a material with a single texture in all or any property. Have a single color on the rest.
SplatMapping: has a SplatMap and 0 to 5 different textures to every property. Properties with o texture uses a single color insted.

All materials with a texture has a UVRepeat, telling how many time to till in U and in V.

modelJobs now uses ShadeID, ModelID and TextureID for the Hash insted of only Texture

MayaExported exports 3 differnt types of material, the same as the piplen now supports.
This commit is contained in:
Teejoon
2016-02-07 13:39:13 +01:00
parent ceab837e27
commit 92ab22e779
20 changed files with 971 additions and 309 deletions
+86 -86
View File
@@ -8,91 +8,91 @@ MeshClass::MeshClass()
}
std::map<int, MeshClass::WeightInfo> MeshClass::GetWeightData()
{
MS status;
map<int, WeightInfo> weightMap;
MItDependencyNodes it(MFn::kSkinClusterFilter);
while (!it.isDone()) {
MObject object = it.thisNode(&status);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + " it.thisNode() ERROR: " + status.errorString());
break;
}
MFnSkinCluster skinCluster(object, &status);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "skinCluster() ERROR: " + status.errorString());
break;
}
MDagPathArray influences;
unsigned int nrOfInfluences = skinCluster.influenceObjects(influences,&status);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "skinCluster.influenceObjects() ERROR: " + status.errorString());
break;
}
unsigned int index;
index = skinCluster.indexForOutputConnection(0,&status);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "skinCluster.indexForOutputConnection() ERROR: " + status.errorString());
break;
}
MDagPath skinPath;
status = skinCluster.getPathAtIndex(index, skinPath);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "skinCluster.getPathAtIndex() ERROR: " + status.errorString());
break;
}
MItGeometry geomIter(skinPath);
//for (unsigned int i = 0; i < nrOfInfluences; i++) {
// MGlobal::displayInfo(MString() + " Influence object name: " + influences[i].partialPathName().asChar());
//}
WeightInfo weightInfo;
while (!geomIter.isDone()) {
MObject comp = geomIter.component(&status);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "geomIter.component() ERROR: " + status.errorString());
break;
}
MFloatArray weights;
unsigned int influenceCount;
status = skinCluster.getWeights(skinPath, comp, weights, influenceCount);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "skinCluster.getWeights() ERROR: " + status.errorString());
break;
}
MFnDependencyNode test(comp);
unsigned int nrOfWeights = 0;
for (unsigned int j = 0; j < weights.length() && nrOfWeights != 4; j++) {
if (weights[j] > 0.00001) {
weightInfo.BoneWeights[nrOfWeights] = weights[j];
weightInfo.BoneIndices[nrOfWeights] = j;
nrOfWeights++;
}
}
float totalWeight = 0.0f;
for (unsigned int i = 0; i < 4; i++) {
totalWeight += weightInfo.BoneWeights[i];
}
for (unsigned int i = 0; i < 4; i++) {
weightInfo.BoneWeights[i] /= totalWeight;
}
weightMap[geomIter.index()] = weightInfo;
geomIter.next();
}
it.next();
}
return weightMap;
}
//std::map<int, MeshClass::WeightInfo> MeshClass::GetWeightData()
//{
// MS status;
// map<int, WeightInfo> weightMap;
//
// MItDependencyNodes it(MFn::kSkinClusterFilter);
//
// while (!it.isDone()) {
//
// MObject object = it.thisNode(&status);
// if (status != MS::kSuccess) {
// MGlobal::displayError(MString() + " it.thisNode() ERROR: " + status.errorString());
// break;
// }
// MFnSkinCluster skinCluster(object, &status);
// if (status != MS::kSuccess) {
// MGlobal::displayError(MString() + "skinCluster() ERROR: " + status.errorString());
// break;
// }
// MDagPathArray influences;
//
// unsigned int nrOfInfluences = skinCluster.influenceObjects(influences,&status);
// if (status != MS::kSuccess) {
// MGlobal::displayError(MString() + "skinCluster.influenceObjects() ERROR: " + status.errorString());
// break;
// }
//
// unsigned int index;
// index = skinCluster.indexForOutputConnection(0,&status);
// if (status != MS::kSuccess) {
// MGlobal::displayError(MString() + "skinCluster.indexForOutputConnection() ERROR: " + status.errorString());
// break;
// }
// MDagPath skinPath;
// status = skinCluster.getPathAtIndex(index, skinPath);
// if (status != MS::kSuccess) {
// MGlobal::displayError(MString() + "skinCluster.getPathAtIndex() ERROR: " + status.errorString());
// break;
// }
//
// MItGeometry geomIter(skinPath);
// //for (unsigned int i = 0; i < nrOfInfluences; i++) {
// // MGlobal::displayInfo(MString() + " Influence object name: " + influences[i].partialPathName().asChar());
// //}
// WeightInfo weightInfo;
//
// while (!geomIter.isDone()) {
// MObject comp = geomIter.component(&status);
// if (status != MS::kSuccess) {
// MGlobal::displayError(MString() + "geomIter.component() ERROR: " + status.errorString());
// break;
// }
// MFloatArray weights;
// unsigned int influenceCount;
// status = skinCluster.getWeights(skinPath, comp, weights, influenceCount);
// if (status != MS::kSuccess) {
// MGlobal::displayError(MString() + "skinCluster.getWeights() ERROR: " + status.errorString());
// break;
// }
// MFnDependencyNode test(comp);
// unsigned int nrOfWeights = 0;
//
// for (unsigned int j = 0; j < weights.length() && nrOfWeights != 4; j++) {
// if (weights[j] > 0.00001) {
// weightInfo.BoneWeights[nrOfWeights] = weights[j];
// weightInfo.BoneIndices[nrOfWeights] = j;
// nrOfWeights++;
// }
// }
//
// float totalWeight = 0.0f;
// for (unsigned int i = 0; i < 4; i++) {
// totalWeight += weightInfo.BoneWeights[i];
// }
// for (unsigned int i = 0; i < 4; i++) {
// weightInfo.BoneWeights[i] /= totalWeight;
// }
// weightMap[geomIter.index()] = weightInfo;
//
// geomIter.next();
// }
// it.next();
// }
// return weightMap;
//}
Mesh MeshClass::GetMeshData(MObjectArray object)
{
@@ -317,7 +317,7 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
}
for (unsigned int i = 0; i < 4; i++) {
thisVertex.BoneWeights[i] = thisVertex.BoneWeights[i] / totalWeight;
//thisVertex.BoneWeights[i] = thisVertex.BoneWeights[i] / totalWeight;
}
} else {
thisVertex.useWeights = false;