Merge branch 'imagebinding' of https://github.com/mp3butcher/OpenSceneGraph into mp3butcher-imagebinding
This commit is contained in:
@@ -96,6 +96,7 @@ SET(TARGET_H
|
||||
${HEADER_PATH}/ImageSequence
|
||||
${HEADER_PATH}/ImageStream
|
||||
${HEADER_PATH}/ImageUtils
|
||||
${HEADER_PATH}/ImageTexture
|
||||
${HEADER_PATH}/io_utils
|
||||
${HEADER_PATH}/KdTree
|
||||
${HEADER_PATH}/Light
|
||||
@@ -307,6 +308,7 @@ SET(TARGET_SRC
|
||||
ImageSequence.cpp
|
||||
ImageStream.cpp
|
||||
ImageUtils.cpp
|
||||
ImageTexture.cpp
|
||||
KdTree.cpp
|
||||
Light.cpp
|
||||
LightModel.cpp
|
||||
|
||||
32
src/osg/ImageTexture.cpp
Normal file
32
src/osg/ImageTexture.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <osg/ImageTexture>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
int ImageTextureBinding::compare(const osg::StateAttribute &sa) const
|
||||
{
|
||||
COMPARE_StateAttribute_Types(ImageTextureBinding,sa)
|
||||
// Compare each parameter in turn against the rhs.
|
||||
COMPARE_StateAttribute_Parameter(_target)
|
||||
COMPARE_StateAttribute_Parameter(_imageunit)
|
||||
COMPARE_StateAttribute_Parameter(_access)
|
||||
COMPARE_StateAttribute_Parameter(_format)
|
||||
COMPARE_StateAttribute_Parameter(_layered)
|
||||
COMPARE_StateAttribute_Parameter(_level)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ImageTextureBinding::apply(osg::State&state) const
|
||||
{
|
||||
if(_target.valid())
|
||||
{
|
||||
osg::Texture::TextureObject *to = _target->getTextureObject( state.getContextID() );
|
||||
if( !to )
|
||||
{
|
||||
// _target never been applied yet
|
||||
_target->apply(state);
|
||||
to = _target->getTextureObject( state.getContextID() );
|
||||
}
|
||||
state.get<osg::GLExtensions>()->glBindImageTexture(_imageunit, to->id(), _level, _layered, _layer, _access, _format);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user