Neatware Header
Home   Products   Forums   Partners   Buy   Company   Contact   Blog   

11. Mesh

In the DirectX 3D mesh is usually stored in a .x file. However there are several build-in meshes such as sphere, box, teapot, .etc in the DirectX 9.0.

  • Build-in Box

    $app mesh box width height depth

creates a build-in box mesh with width, height, and depth.

  • Build-in Cylinder

    $app mesh cylinder radius1 radius2 length slice stacks

creates a build-in cylinder with radius1, radius2, length, slice, and stacks.

  • Build-in Polygon

    $app mesh polygon length sides

    creates a build-in polygon with length and sides.

  • Build-in Sphere

    $app mesh sphere radius slices stacks

    creates a build-in sphere with radius, slices and stacks.

  • Build-in Teapot

    $app mesh teapot

    creates a teapot mesh.

  • Build-in Text

    $app mesh text content deviration extrusion

    creates a text mesh with content, deviration, and extrusion.

  • Build-in Torus

    $app mesh torus innerRadius outerRadius sides rings

    creates a torus mesh with inner radius, outer radius, sides, and rings.

  • Build-in Decl

    $app mesh decl nFaces nVertices Options Decl

    creates a build-in declaration mesh with faces vertices options and decl.

  • Mesh File

    $app mesh file path

creates a mesh file with path.

The regular use of mesh is described as follows:

  • In the shader class declares a mesh array variable mh.

	variable mh
  • In InitDeviceObjects method you can creates a mesh object mh(Object).

	set mh(Object) [$app mesh file $filename]
  • In the RestoreDeviceObjects method you can restore the mesh mh(Object).

  $mh(Object) restore
  • In the InvalidateDeviceObjects method you can invalidate the mesh object mh(Object).

  $mh(Object) invalidate
  • In the DeleteDeviceObjects method you can release the mesh object mh(Object).

  $mh(Object) delete 

Other mesh commands can be used for mesh processing such as clone and render

  • $mh clone mesh options decl [faces]

    clones mesh mh.

  • $mh render [bopaque|id] [balpha]

    renders mesh mh.

  • $mh getNumVertices

    returns the number of vertices of mesh mh.

  • $mh getNumFaces

    returns the number of faces of mesh mh.

  • $mh getVertexBuffer

    returns the pointer of vertex buffer.

  • $mh setVertexBuffer

    sets the vertex buffer.

  • $mh vbuffer

    creates a new vertex buffer object and copy vertex buffer of mesh mh to the new vertex buffer.

  • $mh ibuffer

    creates a new index buffer object and copies index buffer of mesh mh to the new index buffer.

  • $mh vlock [flags]

    locks vertex buffer of mesh mh with flags.

  • $mh vunlock

    unlocks vertex buffer of mh.

  • $mh ilock [flags]

    locks index buffer of mesh mh with flags.

  • $mh iunlock

    unlocks index buffer of mh.

  • $mh vcopy pbuffer size

    copies size of bytes from pbuffer to vertex buffer.

  • $mh icopy pbuffer size

    copies size of bytes from pbuffer to index buffer.

  • $mh computeTangent textureStageIndex tangentIndex binormalIndex wrap

computes tangent of mesh mh with textureStageIndex, tangentIndex, binormalIndex, and wrap.