Function _IrrSetMeshVertices

au3Irr2

au3Irr2 Function Reference

_IrrSetMeshVertices

This sets the value of the list of vertices in a mesh copying them from the supplied vertex array struct.

#Include <au3Irrlicht2.au3>
_IrrSetMeshVertices($h_Mesh, $i_FrameNumber, ByRef $tVertex, $i_MeshBuffer = 0)

 

Parameters

$h_Mesh Handle to a mesh object
$i_FrameNumber Frame number of the mesh to write vertices to (should be 0 for static meshes).
$i_MeshBuffer [optional] Mesh buffer to access.

 

Return Value

Success: None.
Failure: False and @error = 1

 

Remarks

Each vertex represents a point in the mesh that is the corner of one of the group of triangles that is used to construct the mesh.
If the mesh is animated frame number indicates the number of the frame to recover mesh data for if it is not animated this value should be set to 0.
If the mesh contains a number of mesh buffers you can specific which mesh buffer you want to access, if you omit this parameter mesh buffer 0 will be used.

 

Related

_IrrGetMeshVertices, __CreateVertStruct

 

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()