Function __SetVertStruct

au3Irr2

au3Irr2 Function Reference

__SetVertStruct

Helper function: Sets a value into a structure array of vertices.

#Include <au3Irrlicht2.au3>
__SetVertStruct(ByRef $tVertex, $iVertex, $vMember, $vData)

 

Parameters

$tVertex Structure array of vertices as created with __CreateVertStruct
$iVertex Vertex element where specific value shall be set (0-based!)
$vMember One of following values to set:
$VERT_X
$VERT_Y
$VERT_Z
$VERT_NORMALX
$VERT_NORMALY
$VERT_NORMALZ
$VERT_VCOLOR
$VERT_TEXTUREX
$VERT_TEXTUREY

 

Return Value

None.

 

Remarks

None

 

Related

__CreateVertStruct, __GetVertStruct, __CreateVectStruct

 

Example


#include "au3Irrlicht2.au3"

_IrrStart()

local $mesh = _IrrGetMesh( "./media/cube.x" )

local $tVertex; variable for the vertex array struct
; copy the vertex information into the array
local $vertex_count = _IrrGetMeshVertices( $mesh, 0, $tVertex)

local $i
for $i = 0 to $vertex_count - 1 ; itterate through all of the vertices
    ; shrink vertex X location by half its size, then change vertex colour value
    __SetVertStruct($tVertex, $i, $VERT_X, __GetVertStruct($tVertex, $i, $VERT_X) * 0.5 )
    __SetVertStruct($tVertex, $i, $VERT_VCOLOR, _IrrMakeARGB(0, Random(0,255), Random(0,255), Random(0,255) ) )
next ; $i

; copy the altered vertex infomation back to the mesh
_IrrSetMeshVertices( $mesh, 0, $tVertex )

; add mesh and camera to the scene:
local $nodeCube = _IrrAddMeshToScene( $mesh )
_IrrSetNodeMaterialFlag( $nodeCube, $IRR_EMF_LIGHTING, $IRR_OFF )
_IrrSetNodePosition($nodeCube, -0.5, -0.5, 5)

_IrrAddFPSCamera($IRR_NO_OBJECT, 5, 0.01 )

WHILE _IrrRunning()
    _IrrBeginScene( 0, 0, 25 )
    _IrrDrawScene()
    _IrrEndScene()
WEND

_IrrStop()