forked from teamnwah/openmw-tes3coop
Add water texture.
This commit is contained in:
parent
9454f4f2e7
commit
1f32f1eef5
1 changed files with 17 additions and 0 deletions
|
@ -6,7 +6,10 @@
|
|||
#include <osg/PositionAttitudeTransform>
|
||||
|
||||
#include <components/esm/loadland.hpp>
|
||||
#include <components/fallback/fallback.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
#include <components/resource/imagemanager.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/sceneutil/waterutil.hpp>
|
||||
|
||||
#include "../../model/world/cell.hpp"
|
||||
|
@ -155,6 +158,20 @@ namespace CSVRender
|
|||
mWaterGeometry = SceneUtil::createWaterGeometry(size, segments, textureRepeats);
|
||||
mWaterGeometry->setStateSet(SceneUtil::createSimpleWaterStateSet(Alpha, RenderBin));
|
||||
|
||||
// Add water texture
|
||||
std::string textureName = mData.getFallbackMap()->getFallbackString("Water_SurfaceTexture");
|
||||
textureName = "textures/water/" + textureName + "00.dds";
|
||||
|
||||
Resource::ImageManager* imageManager = mData.getResourceSystem()->getImageManager();
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> waterTexture = new osg::Texture2D();
|
||||
waterTexture->setImage(imageManager->getImage(textureName));
|
||||
waterTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||
waterTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||
|
||||
mWaterGeometry->getStateSet()->setTextureAttributeAndModes(0, waterTexture, osg::StateAttribute::ON);
|
||||
|
||||
|
||||
mWaterNode->addDrawable(mWaterGeometry);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue