Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix converting Pbs to Unlit material conversion #230

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions ogre2/src/Ogre2Material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,23 @@ Ogre::HlmsUnlitDatablock *Ogre2Material::UnlitDatablock()
void Ogre2Material::FillUnlitDatablock(Ogre::HlmsUnlitDatablock *_datablock)
const
{
auto tex = this->ogreDatablock->getTexture(Ogre::PBSM_DIFFUSE);
if (tex)
_datablock->setTexture(0, 0, tex);
if (!this->textureName.empty())
{
std::string baseName = common::basename(this->textureName);
Ogre::HlmsTextureManager *hlmsTextureManager =
this->ogreHlmsPbs->getHlmsManager()->getTextureManager();
Ogre::HlmsTextureManager::TextureLocation texLocation =
hlmsTextureManager->createOrRetrieveTexture(baseName,
this->ogreDatablock->suggestMapTypeBasedOnTextureType(
Ogre::PBSM_DIFFUSE));
_datablock->setTexture(0, texLocation.xIdx, texLocation.texture);
}

auto samplerblock = this->ogreDatablock->getSamplerblock(Ogre::PBSM_DIFFUSE);
if (samplerblock)
_datablock->setSamplerblock(0, *samplerblock);
_datablock->setMacroblock(
this->ogreDatablock->getMacroblock());
_datablock->setBlendblock(
this->ogreDatablock->getBlendblock());
_datablock->setMacroblock(this->ogreDatablock->getMacroblock());
_datablock->setBlendblock(this->ogreDatablock->getBlendblock());

_datablock->setUseColour(true);
Ogre::Vector3 c = this->ogreDatablock->getDiffuse();
Expand Down
2 changes: 1 addition & 1 deletion ogre2/src/Ogre2ThermalCamera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void Ogre2ThermalCameraMaterialSwitcher::preRenderTargetUpdate(
Ogre::AxisAlignedBox box = Ogre::AxisAlignedBox(aabb.getMinimum(),
aabb.getMaximum());

// we will be converting rgb values to tempearture values in shaders
// we will be converting rgb values to temperature values in shaders
// but we want to make sure the object rgb values are not affected by
// lighting, so disable lighting
// Also check if objects are within camera view
Expand Down