|
Revision 13041, 2.0 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/PolygonMode> |
|---|
| 15 | #include <osg/Notify> |
|---|
| 16 | |
|---|
| 17 | using namespace osg; |
|---|
| 18 | |
|---|
| 19 | PolygonMode::PolygonMode(): |
|---|
| 20 | _modeFront(FILL), |
|---|
| 21 | _modeBack(FILL) |
|---|
| 22 | { |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | PolygonMode::PolygonMode(Face face,Mode mode): |
|---|
| 26 | _modeFront(FILL), |
|---|
| 27 | _modeBack(FILL) |
|---|
| 28 | { |
|---|
| 29 | setMode(face,mode); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | PolygonMode::~PolygonMode() |
|---|
| 34 | { |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | void PolygonMode::setMode(Face face,Mode mode) |
|---|
| 38 | { |
|---|
| 39 | switch(face) |
|---|
| 40 | { |
|---|
| 41 | case(FRONT): |
|---|
| 42 | _modeFront = mode; |
|---|
| 43 | break; |
|---|
| 44 | case(BACK): |
|---|
| 45 | _modeBack = mode; |
|---|
| 46 | break; |
|---|
| 47 | case(FRONT_AND_BACK): |
|---|
| 48 | _modeFront = mode; |
|---|
| 49 | _modeBack = mode; |
|---|
| 50 | break; |
|---|
| 51 | } |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | PolygonMode::Mode PolygonMode::getMode(Face face) const |
|---|
| 55 | { |
|---|
| 56 | switch(face) |
|---|
| 57 | { |
|---|
| 58 | case(FRONT): |
|---|
| 59 | return _modeFront; |
|---|
| 60 | case(BACK): |
|---|
| 61 | return _modeBack; |
|---|
| 62 | case(FRONT_AND_BACK): |
|---|
| 63 | return _modeFront; |
|---|
| 64 | } |
|---|
| 65 | OSG_WARN<<"Warning : invalid Face passed to PolygonMode::getMode(Face face)"<<std::endl; |
|---|
| 66 | return _modeFront; |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | void PolygonMode::apply(State&) const |
|---|
| 70 | { |
|---|
| 71 | #ifdef OSG_GL1_AVAILABLE |
|---|
| 72 | if (_modeFront==_modeBack) |
|---|
| 73 | { |
|---|
| 74 | glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront); |
|---|
| 75 | } |
|---|
| 76 | else |
|---|
| 77 | { |
|---|
| 78 | glPolygonMode(GL_FRONT,(GLenum)_modeFront); |
|---|
| 79 | glPolygonMode(GL_BACK,(GLenum)_modeBack); |
|---|
| 80 | } |
|---|
| 81 | #else |
|---|
| 82 | OSG_NOTICE<<"Warning: PolygonMode::apply(State&) - not supported."<<std::endl; |
|---|
| 83 | #endif |
|---|
| 84 | } |
|---|