1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00
OpenMW/components/terrain/material.hpp

88 lines
2.2 KiB
C++
Raw Normal View History

#ifndef COMPONENTS_TERRAIN_MATERIAL_H
#define COMPONENTS_TERRAIN_MATERIAL_H
2015-06-03 01:18:36 +02:00
#include <osgFX/Technique>
#include <osgFX/Effect>
2015-06-03 01:18:36 +02:00
#include "defs.hpp"
namespace osg
{
class Texture2D;
}
namespace Shader
{
class ShaderManager;
}
namespace Terrain
{
struct TextureLayer
{
osg::ref_ptr<osg::Texture2D> mDiffuseMap;
osg::ref_ptr<osg::Texture2D> mNormalMap; // optional
2016-03-22 21:00:31 +01:00
bool mParallax;
2016-02-20 19:54:47 +01:00
bool mSpecular;
};
2015-06-03 01:18:36 +02:00
class FixedFunctionTechnique : public osgFX::Technique
{
public:
2015-06-03 01:18:36 +02:00
FixedFunctionTechnique(
const std::vector<TextureLayer>& layers,
const std::vector<osg::ref_ptr<osg::Texture2D> >& blendmaps, int blendmapScale, float layerTileSize);
protected:
virtual void define_passes() {}
};
class ShaderTechnique : public osgFX::Technique
{
public:
ShaderTechnique(Shader::ShaderManager& shaderManager, bool forcePerPixelLighting, bool clampLighting,
const std::vector<TextureLayer>& layers,
const std::vector<osg::ref_ptr<osg::Texture2D> >& blendmaps, int blendmapScale, float layerTileSize);
2015-06-03 01:18:36 +02:00
protected:
virtual void define_passes() {}
};
2013-08-20 09:52:27 +02:00
2015-06-03 01:18:36 +02:00
class Effect : public osgFX::Effect
{
public:
2016-02-19 15:00:50 +01:00
Effect(bool useShaders, bool forcePerPixelLighting, bool clampLighting, Shader::ShaderManager* shaderManager,
const std::vector<TextureLayer>& layers,
const std::vector<osg::ref_ptr<osg::Texture2D> >& blendmaps, int blendmapScale, float layerTileSize);
2015-06-03 01:18:36 +02:00
virtual bool define_techniques();
2015-06-03 01:18:36 +02:00
virtual const char *effectName() const
{
return NULL;
}
virtual const char *effectDescription() const
{
return NULL;
}
virtual const char *effectAuthor() const
{
return NULL;
}
private:
2016-02-19 15:00:50 +01:00
Shader::ShaderManager* mShaderManager;
bool mUseShaders;
bool mForcePerPixelLighting;
bool mClampLighting;
std::vector<TextureLayer> mLayers;
2015-06-03 01:18:36 +02:00
std::vector<osg::ref_ptr<osg::Texture2D> > mBlendmaps;
int mBlendmapScale;
float mLayerTileSize;
};
}
#endif