niStencilProperty⚓︎
A rendering property that controls the use of a stencil buffer when rendering. Stencil buffering allows effects such as cutouts in a screen, decal polygons without Z-buffer "aliasing", and advanced effects such as volumetric shadows. It also includes a draw-mode setting to allow the game engine to control the culling mode of a set of geometry.
This table describes the actions that can be set to occur as a result of tests for niStencilProperty:
Value | Mode | Description |
---|---|---|
0 | ACTION_KEEP | Keep the current value in the stencil buffer. |
1 | ACTION_ZERO | Write zero to the stencil buffer. |
2 | ACTION_REPLACE | Write the reference value to the stencil buffer. |
3 | ACTION_INCREMENT | Increment the value in the stencil buffer. |
4 | ACTION_DECREMENT | Decrement the value in the stencil buffer. |
5 | ACTION_INVERT | Bitwise invert the value in the stencil buffer. |
This type inherits the following: niProperty, niObjectNET, niObject
Properties⚓︎
controller
⚓︎
Read-only. The first controller available on the object.
Returns:
result
(niTimeController)
drawMode
⚓︎
The face drawing (culling) mode used to draw the object.
Value | Mode | Behavior |
---|---|---|
0 | DRAW_CCW_OR_BOTH | The default mode, chooses between DRAW_CCW or DRAW_BOTH. |
1 | DRAW_CCW | Draw only the triangles whose vertices are ordered counter-clockwise with respect to the viewer (Standard behavior). |
2 | DRAW_CW | Draw only the triangles whose vertices are ordered clockwise with respect to the viewer (Effectively flips the faces). |
3 | DRAW_BOTH | Do not cull back faces of any kind. Draw all triangles, regardless of orientation (Effectively force double-sided). |
Returns:
result
(integer)
enabled
⚓︎
The value of the stencil buffer enable flag.
Returns:
result
(boolean)
extraData
⚓︎
Read-only. The first extra data available on the object.
Returns:
result
(niExtraData)
failAction
⚓︎
The action that is taken in the stencil buffer when the stencil test fails. See the table at the top for available actions.
Returns:
result
(integer)
mask
⚓︎
The mask value of the stencil buffer. This value is AND-ed with the reference
and the buffer value prior to comparing and writing the buffer. The default is 0xffffffff
.
Returns:
result
(integer)
name
⚓︎
The human-facing name of the given object.
Returns:
result
(string)
passAction
⚓︎
The action that is taken in the stencil buffer when the stencil test passes and the pixel passes the Z-buffer test. See the table at the top for available actions.
Returns:
result
(integer)
propertyFlags
⚓︎
Returns:
result
(integer)
refCount
⚓︎
Read-only. The number of references that exist for this object. When this value reaches zero, the object will be deleted.
Returns:
result
(number)
reference
⚓︎
The stencil reference value. It's compared against the stencil value at an individual pixel to determine the success of the stencil test.
Returns:
result
(integer)
RTTI
⚓︎
Read-only. The runtime type information for this object. This is an alias for the .runTimeTypeInformation
property.
Returns:
result
(niRTTI)
runTimeTypeInformation
⚓︎
Read-only. The runtime type information for this object.
Returns:
result
(niRTTI)
testFunc
⚓︎
The stencil buffer test function used to test the reference value against the buffer value.
Value | Mode | Description |
---|---|---|
0 | TEST_NEVER | Test will allways return false. Nothing is drawn at all. |
1 | TEST_LESS | The test will only succeed if the pixel is nearer than the previous pixel. |
2 | TEST_EQUAL | Test will only succeed if the z value of the pixel to be drawn is equal to the value of the previous drawn pixel. |
3 | TEST_LESS_EQUAL | Test will succeed if the z value of the pixel to be drawn is smaller than or equal to the value in the Stencil Buffer. |
4 | TEST_GREATER | Opposite of TEST_LESS |
5 | TEST_NOT_EQUAL | Test will succeed if the z value of the pixel to be drawn is NOT equal to the value of the previously drawn pixel. |
6 | TEST_GREATER_EQUAL | Opposite of TEST_LESS_EQUAL. |
7 | TEST_ALWAYS | Test will allways succeed. The Stencil Buffer value is ignored. |
Returns:
result
(integer)
type
⚓︎
Read-only. The unique class identifier number of the given rendering property. The types are available in ni.propertyType
table.
Returns:
result
(ni.propertyType)
zFailAction
⚓︎
The action that is taken in the stencil buffer when the stencil test passes but the pixel fails the Z-buffer test. See the table at the top for available actions.
Returns:
result
(integer)
Methods⚓︎
addExtraData
⚓︎
Appends an extra data to the object.
myObject:addExtraData(extraData)
Parameters:
extraData
(niExtraData)
clone
⚓︎
Creates a copy of this object.
local result = myObject:clone()
Returns:
result
(niObject)
getGameReference
⚓︎
Searches for an niExtraData on this object to see if it has one that holds a related reference.
local reference = myObject:getGameReference(searchParents)
Parameters:
searchParents
(boolean): Default:false
. If true, all parent objects (if applicable) are also searched.
Returns:
reference
(tes3reference)
getStringDataStartingWith
⚓︎
Searches for an niExtraData on this object to see if it has niStringExtraData that has its string start with the provided value
argument.
local extra = myObject:getStringDataStartingWith(value)
Parameters:
value
(string): The first niStringExtraData starting with this value will be returned.
Returns:
extra
(niStringExtraData)
getStringDataWith
⚓︎
Searches for an niExtraData on this object to see if it has niStringExtraData that has the provided value
argument in its string field.
local extra = myObject:getStringDataWith(value)
Parameters:
value
(string): The first niStringExtraData with this word will be returned.
Returns:
extra
(niStringExtraData)
hasStringDataStartingWith
⚓︎
Searches for an niExtraData on this object to see if it has niStringExtraData that has its string start with the provided value
argument. Returns true if the value was found.
local result = myObject:hasStringDataStartingWith(value)
Parameters:
value
(string): The value to search for.
Returns:
result
(boolean)
hasStringDataWith
⚓︎
Searches for an niExtraData on this object to see if it has niStringExtraData that contains the provided value
argument in its string field. Returns true if the value was found.
local result = myObject:hasStringDataWith(value)
Parameters:
value
(string): The value to search for.
Returns:
result
(boolean)
isInstanceOfType
⚓︎
Determines if the object is of a given type, or of a type derived from the given type.
local result = myObject:isInstanceOfType(type)
Parameters:
Returns:
result
(boolean)
isOfType
⚓︎
Determines if the object is of a given type.
local result = myObject:isOfType(type)
Parameters:
Returns:
result
(boolean)
prependController
⚓︎
Add a controller to the object as the first controller.
myObject:prependController(controller)
Parameters:
controller
(niTimeController)
removeAllControllers
⚓︎
Removes all controllers.
myObject:removeAllControllers()
removeAllExtraData
⚓︎
Removes all extra data.
myObject:removeAllExtraData()
removeController
⚓︎
Removes a controller from the object.
myObject:removeController(controller)
Parameters:
controller
(niTimeController)
removeExtraData
⚓︎
Removes a specific extra data from the object.
myObject:removeExtraData(extraData)
Parameters:
extraData
(niExtraData)
saveBinary
⚓︎
Serializes the object, and writes it to the given file.
local success = myObject:saveBinary(path)
Parameters:
path
(string): The path to write the file at, relative to the Morrowind installation folder.
Returns:
success
(boolean): If true the object was successfully serialized.
setFlag
⚓︎
Sets a given flag in the niObjectNET flag data. The specifics use of the flag is dependent on the real underlying type.
myObject:setFlag(state, index)
Parameters:
state
(boolean)index
(number)
Functions⚓︎
new
⚓︎
Creates a new, niStencilProperty. By default it will use a GREATER test function, KEEP on fail, INCREMENT on pass, and use the CCW_OR_BOTH draw mode.
local property = niStencilProperty.new()
Returns:
property
(niStencilProperty)