|
Revision 13041, 1.4 kB
(checked in by robert, 14 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include <osg/GL> |
|---|
| 14 | #include <osg/TexMat> |
|---|
| 15 | #include <osg/Notify> |
|---|
| 16 | #include <osg/TextureRectangle> |
|---|
| 17 | |
|---|
| 18 | using namespace osg; |
|---|
| 19 | |
|---|
| 20 | TexMat::TexMat(): |
|---|
| 21 | _scaleByTextureRectangleSize(false) |
|---|
| 22 | { |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | TexMat::~TexMat() |
|---|
| 27 | { |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | void TexMat::apply(State& state) const |
|---|
| 31 | { |
|---|
| 32 | #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE |
|---|
| 33 | glMatrixMode( GL_TEXTURE ); |
|---|
| 34 | glLoadMatrix(_matrix.ptr()); |
|---|
| 35 | |
|---|
| 36 | if (_scaleByTextureRectangleSize) |
|---|
| 37 | { |
|---|
| 38 | const osg::TextureRectangle* tex = dynamic_cast<const osg::TextureRectangle*>(state.getLastAppliedTextureAttribute(state.getActiveTextureUnit(), osg::StateAttribute::TEXTURE)); |
|---|
| 39 | if (tex) |
|---|
| 40 | { |
|---|
| 41 | glScalef(tex->getTextureWidth(),tex->getTextureHeight(),1.0f); |
|---|
| 42 | } |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | glMatrixMode( GL_MODELVIEW ); |
|---|
| 46 | #else |
|---|
| 47 | OSG_NOTICE<<"Warning: TexMat::apply(State&) - not supported."<<std::endl; |
|---|
| 48 | #endif |
|---|
| 49 | } |
|---|