material definition

changing the beast over to the refactor
This commit is contained in:
marauder2k7 2024-12-27 12:53:04 +00:00
parent 4d980e5406
commit cebfdbc5ec
13 changed files with 61 additions and 105 deletions

View file

@ -170,14 +170,14 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
{
torquePath = texName.C_Str();
if (!torquePath.isEmpty())
mat->mDiffuseMapName[0] = cleanTextureName(torquePath, cleanFile, path, false);
mat->_setDiffuseMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
}
if (AI_SUCCESS == mAIMat->Get(AI_MATKEY_TEXTURE(aiTextureType_NORMALS, 0), texName))
{
torquePath = texName.C_Str();
if (!torquePath.isEmpty())
mat->mNormalMapName[0] = cleanTextureName(torquePath, cleanFile, path, false);
mat->_setNormalMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
}
#ifdef TORQUE_PBR_MATERIALS

View file

@ -208,8 +208,8 @@ Material *ColladaAppMaterial::createMaterial(const Torque::Path& path) const
Material *newMat = MATMGR->allocateAndRegister( cleanName, getName() );
Con::setVariable("$Con::File", oldScriptFile); // restore script path
newMat->mDiffuseMapName[0] = diffuseMap;
newMat->mNormalMapName[0] = normalMap;
newMat->_setDiffuseMap(diffuseMap, 0);
newMat->_setNormalMap(normalMap, 0);
newMat->mDiffuse[0] = diffuseColor;
newMat->mRoughness[0] = roughness;

View file

@ -1030,8 +1030,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
{
Torque::Path diffusePath;
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
diffusePath = Torque::Path(mat->mDiffuseMapName[0]);
if (mat->getDiffuseMapAsset(0).notNull())
diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffusePath = String("warningMat");
@ -1040,8 +1040,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
}
else
{
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
diffuseMap += Torque::Path(mat->mDiffuseMapName[0]);
if (mat->getDiffuseMapAsset(0).notNull())
diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffuseMap += "warningMat";
}
@ -1316,8 +1316,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
{
Torque::Path diffusePath;
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
diffusePath = Torque::Path(mat->mDiffuseMapName[0]);
if (mat->getDiffuseMapAsset(0).notNull())
diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffusePath = String("warningMat");
@ -1326,8 +1326,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
}
else
{
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
diffuseMap += Torque::Path(mat->mDiffuseMapName[0]);
if (mat->getDiffuseMapAsset(0).notNull())
diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffuseMap += "warningMat";
}

View file

@ -252,8 +252,8 @@ void TSLastDetail::update( bool forceUpdate )
// Setup the material for this imposter.
mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
mMaterial->mAutoGenerated = true;
mMaterial->setDiffuseMapFile(diffuseMapPath, 0);
mMaterial->setNormalMapFile(_getNormalMapPath(), 0);
mMaterial->_setDiffuseMap(diffuseMapPath, 0);
mMaterial->_setNormalMap(_getNormalMapPath(), 0);
mMaterial->mImposterLimits.set( (mNumPolarSteps * 2) + 1, mNumEquatorSteps, mPolarAngle, mIncludePoles );
mMaterial->mTranslucent = true;