OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TexMat.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSG_TEXMAT
15 #define OSG_TEXMAT 1
16 
17 #include <osg/StateAttribute>
18 #include <osg/Matrix>
19 
20 namespace osg {
21 
25 {
26  public :
27 
28  TexMat();
29 
30  TexMat(const Matrix& matrix):_matrix(matrix),_scaleByTextureRectangleSize(false) {}
31 
33  TexMat(const TexMat& texmat,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
34  StateAttribute(texmat,copyop),
35  _matrix(texmat._matrix),
36  _scaleByTextureRectangleSize(texmat._scaleByTextureRectangleSize) {}
37 
38  META_StateAttribute(osg, TexMat, TEXMAT);
39 
40  virtual bool isTextureAttribute() const { return true; }
41 
43  virtual int compare(const StateAttribute& sa) const
44  {
45  // Check for equal types, then create the rhs variable
46  // used by the COMPARE_StateAttribute_Parameter macros below.
48 
49  // Compare each parameter in turn against the rhs.
51 
52  return 0; // Passed all the above comparison macros, so must be equal.
53  }
54 
56  inline void setMatrix(const Matrix& matrix) { _matrix = matrix; }
57 
59  inline Matrix& getMatrix() { return _matrix; }
60 
62  inline const Matrix& getMatrix() const { return _matrix; }
63 
69  void setScaleByTextureRectangleSize(bool flag) { _scaleByTextureRectangleSize = flag; }
70 
72  bool getScaleByTextureRectangleSize() const { return _scaleByTextureRectangleSize; }
73 
75  virtual void apply(State& state) const;
76 
77  protected:
78 
79  virtual ~TexMat( void );
80 
83 
84 };
85 
86 }
87 
88 
89 #endif
#define OSG_EXPORT
Definition: Export.h:43
TexMat(const TexMat &texmat, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: TexMat.h:33
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
TexMat(const Matrix &matrix)
Definition: TexMat.h:30
bool getScaleByTextureRectangleSize() const
Definition: TexMat.h:72
virtual int compare(const StateAttribute &sa) const
Definition: TexMat.h:43
bool _scaleByTextureRectangleSize
Definition: TexMat.h:82
void setScaleByTextureRectangleSize(bool flag)
Definition: TexMat.h:69
const Matrix & getMatrix() const
Definition: TexMat.h:62
#define META_StateAttribute(library, name, type)
virtual bool isTextureAttribute() const
Definition: TexMat.h:40
Definition: AlphaFunc.h:19
void setMatrix(const Matrix &matrix)
Definition: TexMat.h:56
#define COMPARE_StateAttribute_Parameter(parameter)
Matrix _matrix
Definition: TexMat.h:81
Matrix & getMatrix()
Definition: TexMat.h:59