osg.StateSet¶
-
class
osg.
StateSet
¶ Represents: c++ class Wraps: osg::StateSet Bases: osg.Object
Stores a set of modes and attributes which represent a set of OpenGL state. Notice that a
osg.StateSet
contains just a subset of the whole OpenGL state. In OSG, eachosg.Drawable
and eachosg.Node
has a reference to StateSet. These StateSets can be shared between differentosg.Drawable
s andosg.Node
s (that is, severalosg.Drawable
s andosg.Node
s can reference the same StateSet). Indeed, this practice is recommended whenever possible, as this minimizes expensive state changes in the graphics pipeline.Constructors:
-
osg.
StateSet
()¶
Methods:
-
:
setAttribute
(osg.StateAttribute attrib, unsigned value)¶ Set this
osg.StateSet
to contain specified attribute and override flag.Параметры: - attrib (
osg.StateAttribute
) – - value (
unsigned
) –
- attrib (
-
:
setAttribute
(osg.StateAttribute attrib) Short version.
setAttribute
call withosg.StateAttribute.ON
as second argument.Параметры: attrib ( osg.StateAttribute
) –
-
:
setAttributeMode
(osg.StateAttribute.Type attribType, unsigned val)¶ Helper function setting mode for specified attribute.
Параметры: - attribType (
osg.StateAttribute.Type
) – - val (
unsigned
) –
- attribType (
-
:
getAttributeMode
(osg.StateAttribute.Type type)¶ Helper function getting mode for specified attribute.
Параметры: type ( osg.StateAttribute.Type
) –Тип результата: int
-
:
getAttributeList
()¶ Helper function. Returns Lua table with all attributes.
-
:
removeAttribute
(osg.StateAttribute.Type type, unsigned member)¶ Remove attribute of specified type from StateSet.
Параметры: - type (
osg.StateAttribute.Type
) – - member (
unsigned
) –
- type (
-
:
removeAttribute
(osg.StateAttribute attrib) Remove attribute from StateSet.
Параметры: attrib ( osg.StateAttribute
) –
-
:
getAttribute
(osg.StateAttribute.Type type, unsigned member)¶ Get specified StateAttribute for specified type. Returns
nil
if no type is contained within StateSet.Параметры: - type (
osg.StateAttribute.Type
) – - member (
unsigned
) –
Тип результата: - type (
-
:
getAttribute
(osg.StateAttribute.Type type) Short version.
getAttribute
call with0
as second argument;Параметры: type ( osg.StateAttribute.Type
) –Тип результата: osg.StateAttribute
-
:
setMode
(osg.StateAttribute.GLMode mode, int val)¶ Set this
osg.StateSet
to contain the specified GLMode with a given value. Don’t use this method to set modes related to textures. For this purpose, useosg.StateSet.setTextureMode()
, that accepts an extra parameter specifying which texture unit shall be affected by the call.Параметры: - mode (
osg.StateAttribute.GLMode
) – - val (
int
) –
- mode (
-
:
setMode
(GLenum.Value mode, int val) -
Параметры: - mode (
GLenum.Value
) – - val (
int
) –
- mode (
-
:
getModeList
()¶ Helper function. Returns Lua table where key is
osg.StateAttribute.GLMode
and value isnumber
.
-
:
getMode
(osg.StateAttribute.GLMode mode)¶ Get the value for a given
osg.StateAttribute.GLMode
. Ifmode
is contained within this StateSet, returns the value associated with it. Otherwise, returnsosg.StateSet.INHERIT_RENDERBIN_DETAILS
. Don’t use this method to get the value of modes related to textures. For this purpose, useosg.StateSet.removeTextureMode()
, that accepts an extra parameter specifying which texture unit shall be affected by the call.Параметры: mode ( osg.StateAttribute.GLMode
) – Theosg.StateAttribute.GLMode
whose value is desired.Тип результата: int
-
:
removeMode
(osg.StateAttribute.GLMode mode)¶ Remove mode from this StateSet. Don’t use this method to remove modes related to textures. For this purpose, use
osg.StateSet.removeTextureMode()
, that accepts an extra parameter specifying which texture unit shall be affected by the call.Параметры: mode ( osg.StateAttribute.GLMode
) –
-
:
setAttributeAndModes
(osg.StateAttribute attrib)¶ Short version.
setAttributeAndModes
call withosg.StateAttribute.ON
as second argument;Параметры: attrib ( osg.StateAttribute
) –
-
:
setAttributeAndModes
(osg.StateAttribute attrib, int mode) Set this
osg.StateSet
to contain specified attribute and set the associated GLMode’s to specified value.Параметры: - attrib (
osg.StateAttribute
) – - mode (
int
) –
- attrib (
-
:
setTextureMode
(unsigned unit, osg.StateAttribute.GLMode mode, int val)¶ -
Параметры: - unit (
unsigned
) – The texture unit to be affected (used with multi-texturing). - mode (
osg.StateAttribute.GLMode
) – The OpenGL mode to be added to the StateSet. - val (
int
) – The value to be assigned to mode.
- unit (
-
:
getTextureMode
(unsigned unit, osg.StateAttribute.GLMode mode)¶ Get specified GLModeValue for specified
osg.StateAttribute.GLMode
. Returnsosg.StateSet.INHERIT_RENDERBIN_DETAILS
if no GLModeValue is contained within StateSet.Параметры: - unit (
unsigned
) – - mode (
osg.StateAttribute.GLMode
) –
Тип результата: int
- unit (
-
:
getTextureModeList
()¶ Return the list of all Texture related GLModes contained in this StateSet. Return value is Lua table.
-
:
removeTextureMode
(unsigned unit, osg.StateAttribute.GLMode mode)¶ Remove texture mode from
osg.StateSet
.Параметры: - unit (
unsigned
) – - mode (
osg.StateAttribute.GLMode
) –
- unit (
-
:
setTextureAttribute
(unsigned unit, osg.StateAttribute attrib, int val)¶ Set this
osg.StateSet
to contain specified attribute and override flag.Параметры: - unit (
unsigned
) – - attrib (
osg.StateAttribute
) – - val (
int
) –
- unit (
-
:
setTextureAttribute
(unsigned unit, osg.StateAttribute attrib) Short version.
setTextureAttribute
call withosg.StateAttribute.OFF
as last argument;Параметры: - unit (
unsigned
) – - attrib (
osg.StateAttribute
) –
- unit (
-
:
getTextureAttribute
(unsigned unit, osg.StateAttribute.Type type)¶ Get specified Texture related StateAttribute for specified type. Returns
nil
if no type is contained within StateSet.Параметры: - unit (
unsigned
) – - type (
osg.StateAttribute.Type
) –
Тип результата: - unit (
-
:
setTextureAttributeMode
(unsigned unit, osg.StateAttribute.Type attribType, int val)¶ -
Параметры: - unit (
unsigned
) – - attribType (
osg.StateAttribute.Type
) – - val (
int
) –
- unit (
-
:
getTextureAttributeMode
(unsigned unit, osg.StateAttribute.Type type)¶ -
Параметры: - unit (
unsigned
) – - type (
osg.StateAttribute.Type
) –
Тип результата: int
- unit (
-
:
getTextureAttributeList
()¶ Return the list of all Texture related StateAttributes contained in this StateSet. Return value is Lua table.
-
:
removeTextureAttribute
(unsigned unit, osg.StateAttribute.Type type)¶ Remove texture attribute of specified type from StateSet.
Параметры: - unit (
unsigned
) – - type (
osg.StateAttribute.Type
) –
- unit (
-
:
setTextureAttributeAndModes
(unsigned unit, osg.StateAttribute attrib, int val)¶ Set this
osg.StateSet
to contain specified attribute and set the associated GLMode’s to specified value.Параметры: - unit (
unsigned
) – - attrib (
osg.StateAttribute
) – - val (
int
) –
- unit (
-
:
setTextureAttributeAndModes
(unsigned unit, osg.StateAttribute attrib) Short version.
setTextureAttributeAndModes
call withosg.StateAttribute.ON
as last argument;Параметры: - unit (
unsigned
) – - attrib (
osg.StateAttribute
) –
- unit (
-
:
clear
()¶ Clear the
osg.StateSet
of all modes and attributes.
-
:
merge
(osg.StateSet rhs)¶ Merge this
osg.StateSet
with theosg.StateSet
passed as parameter. Every mode and attribute in thisosg.StateSet
that is marked withosg.StateAttribute.OVERRIDE
is replaced with the equivalent mode or attribute fromrhs
.Параметры: rhs ( osg.StateSet
) –
-
:
getNumParents
()¶ Get the number of parents of this StateSet.
Тип результата: unsigned
-
:
getParent
(unsigned index)¶ Get a single const parent of this StateSet.
Параметры: index ( unsigned
) – index of the parent to get.Тип результата: osg.Object
-
:
setRenderingHint
(unsigned hint)¶ -
Параметры: hint ( unsigned
) –
-
:
getRenderingHint
()¶ Get the
osg.StateSet.RenderingHint
of this StateSet.Тип результата: unsigned
-
:
setRenderBinDetails
(int binNum, std.string binName, osg.StateSet.RenderBinMode mode)¶ Set the render bin details.
Параметры: - binNum (
int
) – - binName (
std.string
) – - mode (
osg.StateSet.RenderBinMode
) –
- binNum (
-
:
setRenderBinToInherit
()¶ Set the render bin details to inherit.
-
:
useRenderBinDetails
()¶ Get whether the render bin details are set and should be used.
Тип результата: bool
-
:
setRenderBinMode
(osg.StateSet.RenderBinMode mode)¶ Set the render bin mode.
Параметры: mode ( osg.StateSet.RenderBinMode
) –
-
:
getRenderBinMode
()¶ Get the render bin mode.
Тип результата: osg.StateSet.RenderBinMode
-
:
setBinNumber
(int num)¶ Set the render bin number.
Параметры: num ( int
) –
-
:
getBinNumber
()¶ Get the render bin number.
Тип результата: int
-
:
setBinName
(std.string name)¶ Set the render bin name.
Параметры: name ( std.string
) –
-
:
getBinName
()¶ Get the render bin name.
Тип результата: std.string
-
:
setNestRenderBins
(bool b)¶ By default render bins will be nested within each other dependent upon where they are set in the scene graph. This can be problematic if a transparent render bin is attached to an opaque render bin which is attached to another transparent render bin as these render bins will be sorted separately, giving the wrong draw ordering for back-to-front transparency. Therefore, to prevent render bins being nested, call
osg.StateSet.setNestRenderBins()
with argumentfalse
.Параметры: b ( bool
) –
-
:
getNestRenderBins
()¶ Get whether associated RenderBin should be nested within parents RenderBin.
Тип результата: bool
-
:
addUniform
(osg.Uniform uniform, int mode)¶ Set this
osg.StateSet
to contain specifiedosg.Uniform
and override flag.Параметры: - uniform (
osg.Uniform
) – - mode (
int
) –
- uniform (
-
:
addUniform
(osg.Uniform uniform) Short version.
addUniform
call withosg.StateAttribute.ON
as last argument.Параметры: uniform ( osg.Uniform
) –
-
:
setUniformMode
(std.string name, int mode)¶ -
Параметры: - name (
std.string
) – - mode (
int
) –
- name (
-
:
getUniformMode
(std.string name)¶ -
Параметры: name ( std.string
) –Тип результата: int
-
:
removeUniform
(std.string name)¶ Remove
osg.Uniform
of specified name from StateSet.Параметры: name ( std.string
) –
-
:
removeUniform
(osg.Uniform uniform) Remove
osg.Uniform
from StateSet.Параметры: uniform ( osg.Uniform
) –
-
:
getUniform
(std.string name)¶ Get
osg.Uniform
for specified name. Returnsnil
if no matchingosg.Uniform
is contained within StateSet.Параметры: name ( std.string
) –Тип результата: osg.Uniform
-
:
getOrCreateUniform
(std.string name, osg.Uniform.Type type, unsigned numElements)¶ Get
osg.Uniform
for specified name, if one is not available create it, add it to thisosg.StateSet
and return a pointer to it.Параметры: - name (
std.string
) – - type (
osg.Uniform.Type
) – - numElements (
unsigned
) –
Тип результата: - name (
-
:
getOrCreateUniform
(std.string name, osg.Uniform.Type type) Short version.
getOrCreateUniform
call with1
as last argument.Параметры: - name (
std.string
) – - type (
osg.Uniform.Type
) –
Тип результата: - name (
-
:
getUniformList
()¶ Return the list of all Uniforms contained in this StateSet. Return value is Lua table where key is
osg.Uniform
and value is uniform mode value (number).
-
:
setDefine
(std.string defineName, int val)¶ Added define pass on to shaders that use utilize that define, as specified by the GLSL
#pragma import_defines(..)
and#pragma requires(..)
.Параметры: - defineName (
std.string
) – - val (
int
) –
- defineName (
-
:
setDefine
(std.string defineName, std.string defineValue, int val) Added define with value to pass on to shaders that use utilize that define, as specified by the GLSL
#pragma import_defines(..)
and#pragma requires(..)
.Параметры: - defineName (
std.string
) – - defineValue (
std.string
) – - val (
int
) –
- defineName (
-
:
removeDefine
(std.string defineName)¶ Remove define.
Параметры: defineName ( std.string
) –
-