OpenSceneGraph 3.6.5
TexMat
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
20namespace osg {
21
25{
26 public :
27
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),
37
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
70
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 COMPARE_StateAttribute_Parameter(parameter)
COMPARE_StateAttribute_Parameter macro is a helper for implementing the StatateAtribute::compare(....
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
COMPARE_StateAttribute_Types macro is a helper for implementing the StateAtribute::compare(....
Definition StateAttribute:57
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Matrixd Matrix
Definition Matrix:27
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ TEXMAT
Definition StateAttribute:147
bool _scaleByTextureRectangleSize
Definition TexMat:82
const Matrix & getMatrix() const
Get the const texture matrix.
Definition TexMat:62
bool getScaleByTextureRectangleSize() const
Get whether the post scaling of the TexMat matrix, by the size of the last applied texture rectangle,...
Definition TexMat:72
Matrix & getMatrix()
Get the texture matrix.
Definition TexMat:59
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition TexMat:43
void setScaleByTextureRectangleSize(bool flag)
Switch on/off the post scaling of the TexMat matrix by the size of the last applied texture rectangle...
Definition TexMat:69
virtual bool isTextureAttribute() const
Return true if StateAttribute is a type which controls texturing and needs to be issued w....
Definition TexMat:40
virtual void apply(State &state) const
Apply texture matrix to OpenGL state.
Matrix _matrix
Definition TexMat:81
META_StateAttribute(osg, TexMat, TEXMAT)
TexMat(const Matrix &matrix)
Definition TexMat:30
void setMatrix(const Matrix &matrix)
Set the texture matrix.
Definition TexMat:56
TexMat(const TexMat &texmat, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition TexMat:33
virtual ~TexMat(void)
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.