add flexier Image Unit Binding implementation (allow different IUBs for a Texture)
This commit is contained in:
committed by
Julien Valentin
parent
5afd32b2d9
commit
2f8a262a0e
@@ -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
|
||||
|
||||
28
src/osg/ImageTexture.cpp
Normal file
28
src/osg/ImageTexture.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#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