Added #Pragma(tic) shader composition for passing widht and height into the shader
This commit is contained in:
parent
1d4bf56fd3
commit
e9c8e3d4a7
@ -415,6 +415,14 @@ void Leia::configure(osgViewer::View& view) const
|
||||
osg::ref_ptr<osg::Program> program = new osg::Program();
|
||||
stateset->setAttribute(program.get(), osg::StateAttribute::ON);
|
||||
|
||||
osg::MakeString defineValue;
|
||||
defineValue << width;
|
||||
stateset->setDefine("WINDOW_WIDTH", defineValue.str());
|
||||
|
||||
defineValue.clear();
|
||||
defineValue << height;
|
||||
stateset->setDefine("WINDOW_HEIGHT", defineValue.str());
|
||||
|
||||
std::string vsFileName("leia_interleave.vert");
|
||||
std::string fsFileName("leia_interleave.frag");
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#extension GL_EXT_texture_array : enable
|
||||
|
||||
#pragma import_defines ( WINDOW_WIDTH, WINDOW_HEIGHT )
|
||||
|
||||
uniform sampler2DArray texture_0;
|
||||
uniform sampler2DArray texture_1;
|
||||
uniform sampler2DArray texture_2;
|
||||
@ -9,9 +11,6 @@ varying vec2 texcoord;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float WINDOW_WIDTH = 1920.0;
|
||||
float WINDOW_HEIGHT = 1080.0;
|
||||
|
||||
float cell_width = WINDOW_WIDTH/4.0;
|
||||
float cell_height = WINDOW_HEIGHT/4.0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user