WS30: Pass material parameter/edge-hardness to shader

This commit is contained in:
Stuart Buchanan
2022-01-15 14:52:33 +00:00
parent a95b531409
commit 4ed559d5a9
2 changed files with 7 additions and 1 deletions

View File

@@ -397,7 +397,7 @@ SGMaterialCache::Atlas SGMaterialLib::getMaterialTextureAtlas(SGVec2f center, co
continue;
}
atlas.dimensions->setElement(materialLookupIndex, osg::Vec4f(mat->get_xsize(), mat->get_ysize(), mat->get_shininess(), 1.0f));
atlas.dimensions->setElement(materialLookupIndex, osg::Vec4f(mat->get_xsize(), mat->get_ysize(), mat->get_shininess(), mat->get_parameter("edge-hardness")));
atlas.ambient->setElement(materialLookupIndex, mat->get_ambient());
atlas.diffuse->setElement(materialLookupIndex, mat->get_diffuse());
atlas.specular->setElement(materialLookupIndex, mat->get_specular());

View File

@@ -1438,6 +1438,12 @@ void VPBTechnique::applyMaterials(BufferData& buffer, Locator* masterLocator)
const osg::Array* vertices = buffer._landGeometry->getVertexArray();
const osg::Array* texture_coords = buffer._landGeometry->getTexCoordArray(0);
osgTerrain::Layer* colorLayer = _terrainTile->getColorLayer(0);
if (!colorLayer) {
SG_LOG(SG_TERRAIN, SG_ALERT, "No landclass image for " << _terrainTile->getTileID().x << " " << _terrainTile->getTileID().y << " " << _terrainTile->getTileID().level);
return;
}
osg::Image* image = colorLayer->getImage();
if (!image || ! image->valid()) {