TexMat
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_TEXMAT
#define OSG_TEXMAT 1
#include <osg/StateAttribute>
#include <osg/Matrix>
namespace osg {
class OSG_EXPORT TexMat : public StateAttribute
{
public :
TexMat();
TexMat(const Matrix& matrix):_matrix(matrix),_scaleByTextureRectangleSize(false) {}
TexMat(const TexMat& texmat,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(texmat,copyop),
_matrix(texmat._matrix),
_scaleByTextureRectangleSize(texmat._scaleByTextureRectangleSize) {}
META_StateAttribute(osg, TexMat, TEXMAT);
virtual bool isTextureAttribute() const { return true; }
virtual int compare(const StateAttribute& sa) const
{
// Check for equal types, then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(TexMat,sa)
// Compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_matrix)
return 0; // Passed all the above comparison macros, so must be equal.
}
inline void setMatrix(const Matrix& matrix) { _matrix = matrix; }
inline Matrix& getMatrix() { return _matrix; }
inline const Matrix& getMatrix() const { return _matrix; }
void setScaleByTextureRectangleSize(bool flag) { _scaleByTextureRectangleSize = flag; }
bool getScaleByTextureRectangleSize() const { return _scaleByTextureRectangleSize; }
virtual void apply(State& state) const;
protected:
virtual ~TexMat( void );
Matrix _matrix;
bool _scaleByTextureRectangleSize;
};
}
#endif
Matrix
StateAttribute
COMPARE_StateAttribute_Parameter
#define COMPARE_StateAttribute_Parameter(parameter)
Definition StateAttribute:69
COMPARE_StateAttribute_Types
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::TEXMAT
@ TEXMAT
Definition StateAttribute:147
osg::State
Definition State:80
osg::TexMat::_scaleByTextureRectangleSize
bool _scaleByTextureRectangleSize
Definition TexMat:82
osg::TexMat::getMatrix
const Matrix & getMatrix() const
Definition TexMat:62
osg::TexMat::getScaleByTextureRectangleSize
bool getScaleByTextureRectangleSize() const
Definition TexMat:72
osg::TexMat::getMatrix
Matrix & getMatrix()
Definition TexMat:59
osg::TexMat::compare
virtual int compare(const StateAttribute &sa) const
Definition TexMat:43
osg::TexMat::setScaleByTextureRectangleSize
void setScaleByTextureRectangleSize(bool flag)
Definition TexMat:69
osg::TexMat::isTextureAttribute
virtual bool isTextureAttribute() const
Definition TexMat:40
osg::TexMat::apply
virtual void apply(State &state) const
osg::TexMat::_matrix
Matrix _matrix
Definition TexMat:81
osg::TexMat::META_StateAttribute
META_StateAttribute(osg, TexMat, TEXMAT)
osg::TexMat::TexMat
TexMat(const Matrix &matrix)
Definition TexMat:30
osg::TexMat::setMatrix
void setMatrix(const Matrix &matrix)
Definition TexMat:56
osg::TexMat::TexMat
TexMat(const TexMat &texmat, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition TexMat:33
osg::TexMat::~TexMat
virtual ~TexMat(void)
osg::TexMat::TexMat
TexMat()
osg
Definition AlphaFunc:19
osg::Matrix
Matrixd Matrix
Definition Matrix:27
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39