From 62cc09141433b939a586992e8aee1b7a090a5d51 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 2 Mar 2017 18:07:01 +0100 Subject: [PATCH] Fix incorrect setting of TexMat in terrain material --- components/terrain/material.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/terrain/material.cpp b/components/terrain/material.cpp index fa87c53ec..323f41798 100644 --- a/components/terrain/material.cpp +++ b/components/terrain/material.cpp @@ -21,13 +21,14 @@ namespace Terrain osg::ref_ptr texMat = texMatMap[blendmapScale]; if (!texMat) { - texMat = new osg::TexMat; osg::Matrixf matrix; float scale = (blendmapScale/(static_cast(blendmapScale)+1.f)); matrix.preMultTranslate(osg::Vec3f(0.5f, 0.5f, 0.f)); matrix.preMultScale(osg::Vec3f(scale, scale, 1.f)); matrix.preMultTranslate(osg::Vec3f(-0.5f, -0.5f, 0.f)); + texMat = new osg::TexMat(matrix); + texMatMap[blendmapScale] = texMat; } return texMat; @@ -39,8 +40,7 @@ namespace Terrain osg::ref_ptr texMat = texMatMap[layerTileSize]; if (!texMat) { - texMat = new osg::TexMat; - texMat->setMatrix(osg::Matrix::scale(osg::Vec3f(layerTileSize,layerTileSize,1.f))); + texMat = new osg::TexMat(osg::Matrix::scale(osg::Vec3f(layerTileSize,layerTileSize,1.f))); texMatMap[layerTileSize] = texMat; }