Function __GetVertStruct

au3Irr2

au3Irr2 Function Reference

__GetVertStruct

Helper function: Returns a specific value from a structure array of vertices.

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

 

Parameters

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

 

Return Value

Success: Requested $vMember

 

Remarks

None

 

Related

__CreateVertStruct, __SetVertStruct, __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()