#include <sglStatelet.hpp>
Inheritance diagram for sglMultiTextureStatelet::
Public Methods | |
sglMultiTextureStatelet (sglTexturingStatelet *statelet, unsigned int unit=0) | |
virtual | ~sglMultiTextureStatelet () |
void | setTextureUnit (unsigned int unit) |
unsigned int | getTextureUnit () const |
void | setStatelet (sglTexturingStatelet *statelet) |
sglTexturingStatelet* | getStatelet () const |
void | apply (sglCurrState *curr_state) const |
virtual bool | getSorted () const |
Protected Methods | |
unsigned int | getType () const |
Example:
The following example shows how to set up two texture units with different textures. Note how the sglTexCoords class is used to specify different texture coordinates for the different units:
vector<sglStatelet*> state; vector<sglTexCoords> tex_coords; // setup for unit 0 (a 2D texture) sglTexture *tex0 = new sglTexture2D; tex0->setImage(...); sglTexEnv *tenv0 = new sglTexEnv; tenv0->setMode(...); sglTextureMatrix *tmat0 = new sglTextureMatrix(...); sglVec2f *tcoords0 = new sglVec2f[...]; tex_coords.push_back(sglTexCoords((float*)tcoords0, 2)); state->push_back(new sglMultiTextureStatelet(tex0, 0)); state->push_back(new sglMultiTextureStatelet(tenv0, 0)); state->push_back(new sglMultiTextureStatelet(tmat0, 0)); // setup for unit 1 (a 1D texture) sglTexture *tex1 = new sglTexture1D; tex1->setImage(...); float *tcoords1 = new float[...]; tex_coords.push_back(sglTexCoords(tcoords1, 1)); state->push_back(new sglMultiTextureStatelet(tex1, 1)); state->push_back(new sglMultiTextureStatelet(tgen0, 1)); // some subclass of sglDrawable... geometry->setState(0, state, tex_coords);
Definition at line 2243 of file sglStatelet.hpp.
|
Constructor.
Definition at line 2252 of file sglStatelet.hpp. |
|
Virtual destructor. This will dereference the contained statelet and if its reference count goes to zero it will be destructed as well. |
|
Set the texture unit to which the contained sglTexturingStatelet object is applied.
Definition at line 2270 of file sglStatelet.hpp. |
|
Query the current texture unit.
Definition at line 2276 of file sglStatelet.hpp. |
|
Set the current sglTexturingStatelet object. This will reference the new one (increment the reference count) and dereference any previous statelet. If the previous statelet's reference count goes to zero it will NOT be deleted.
Referenced by sglMultiTextureStatelet(). |
|
Query the current sglTexturingStateletObject.
Definition at line 2289 of file sglStatelet.hpp. |
|
Apply this state change to the current rendering state.
Reimplemented from sglStatelet. |
|
Query the sorting mode for this statelet.
Reimplemented from sglStatelet. Definition at line 2295 of file sglStatelet.hpp. |
|
Get an identifier for the type of this statelet.
Reimplemented from sglStatelet. |