i'm always working on the FVF (^_^)
remstart
/*
Name: fvf.inc
Desc: Flexible Vertex Format Include
*/ 0.08.r1.alpha
remend
`---------------
`// Constants
`---------------
#constant FVF_XYZ 0x002
#constant FVF_XYZRHW 0x004
#constant FVF_XYZB1 0x006
#constant FVF_XYZB2 0x008
#constant FVF_XYZB3 0x00a
#constant FVF_XYZB4 0x00c
#constant FVF_XYZB5 0x00e
#constant FVF_NORMAL 0x010
#constant FVF_PSIZE 0x020
#constant FVF_DIFFUSE 0x040
#constant FVF_SPECULAR 0x080
#constant FVF_TEX0 0x000
#constant FVF_TEX1 0x100
#constant FVF_TEX2 0x200
#constant FVF_TEX3 0x300
#constant FVF_TEX4 0x400
#constant FVF_TEX5 0x500
#constant FVF_TEX6 0x600
#constant FVF_TEX7 0x700
#constant FVF_TEX8 0x800
#constant FVF_TEXTUREFORMAT1 3
#constant FVF_TEXTUREFORMAT2 0
#constant FVF_TEXTUREFORMAT3 1
#constant FVF_TEXTUREFORMAT4 2
`------------------
`// Default Type
`------------------
type D3DVERTEX_t
px, py, pz as float
nx, ny, nz as float
d as dword
tu, tv as float
endtype
type D3DFVF_HEADER_t
Version as dword
SizeOf as dword
NumVert as dword
endtype
#constant CD3DVERTEX ( FVF_XYZ+FVF_NORMAL+FVF_DIFFUSE+FVF_TEX1 )
`/* ---------------------------------
` Name: D3DVERTEXBUFFER( )
` Desc: a Vertex Buffer for storing
` FVF Mesh Data
` --------------------------------- */
function D3DVERTEXBUFFER( dwCode as dword, dwSizeOf as dword, dwNumVert as dword )
`{ DWORD
local result as dword
local addr as dword
result=make memory( 12+( dwSizeOf*dwNumVert ) )
addr=result
*addr=dwCode
addr=addr+4
*addr=dwSizeOf
addr=addr+4
*addr=dwNumVert
endfunction result
`}
`/* -------------------------------------
` Name: D3DVERTEX( )
` Desc: Stores a vertex (in D3D format)
` ------------------------------------- */
function D3DVERTEX( pMemory as dword, _
px as float, py as float, pz as float, _
nx as float, ny as float, nz as float, _
d as dword, tu as float, ty as float )
`{ DWORD
local addr as dword = pMemory
*addr=px : addr=addr+4
*addr=py : addr=addr+4
*addr=pz : addr=addr+4
*addr=nz : addr=addr+4
*addr=ny : addr=addr+4
*addr=nz : addr=addr+4
*addr=d : addr=addr+4
*addr=tu : addr=addr+4
*addr=tv : addr=addr+4
endfunction addr
`}
`/* -------------------------------------
` Name: D3DFVF_TEXCOORDSIZEn( )
` Desc: Texture Coordinate Sizes
` ------------------------------------- */
function D3DFVF_TEXCOORDSIZE1( CoordIndex as byte )
`{
local result as dword
result = (FVF_TEXTUREFORMAT1<<(CoordIndex*2 + 16))
endfunction result
`}
function D3DFVF_TEXCOORDSIZE2( CoordIndex as byte )
`{
local result as dword
result = (FVF_TEXTUREFORMAT2)
endfunction result
`}
function D3DFVF_TEXCOORDSIZE3( CoordIndex as byte )
`{
local result as dword
result = (FVF_TEXTUREFORMAT3<<(CoordIndex*2 + 16))
endfunction result
`}
function D3DFVF_TEXCOORDSIZE4( CoordIndex as byte )
`{
local result as dword
result = (FVF_TEXTUREFORMAT4<<(CoordIndex*2 + 16))
endfunction result
`}
`/* -------------------------------------
` Name: D3DFVF_SizeOf( )
` Desc: Size of the a vertex definition
` ------------------------------------- */
function D3DFVF_SizeOf( dwCode as dword )
`{ INT
local SizeOf as integer
local dim binCode(32) as boolean
local i as integer
local j as integer
for i=0 to 31
binCode(i)=val(mid$(bin$(dwCode),i))
next i
j=dwCode>>4
if j=FVF_XYZ
SizeOf=SizeOf+16
else
SizeOf=SizeOf+(12+(4*((j/2)-2)))
endif
j=(dwCode>>8)-j
if binCode(4)=1 then SizeOf=SizeOf+12
if binCode(5)=1 then SizeOf=SizeOf+4
if binCode(6)=1 then SizeOf=SizeOf+4
if binCode(7)=1 then SizeOf=SizeOf+4
local texCoords as byte
local texCoord1 as byte
local texCoord2 as byte
for i=0 to 2
if binCode(8+i)=1 then texCoord1=texCoord1+(2^(i+1))
if binCode(12+i)=1 then texCoord2=texCoord2+(2^(i+1))
next i
texCoords=texCoord1+texCoord2
SizeOf=SizeOf+(4*texCoords)
undim binCode(32)
endfunction SizeOf
`}
`/* --------------------------------------
` Name: make_fvf_from_memory()
` Desc: creates a DarkBasic useable mesh
` from Vertex Buffer
` -------------------------------------- */
function make_fvf_from_memory( pMemory as dword )
`{
local addr as dword = pMemory
local header as D3DFVF_HEADER_t
local pos as integer = NULL
local i as integer = NULL
local mb as integer = (g_Memblock=g_Memblock+1)
local mesh as integer = (g_Mesh=g_Mesh+1)
header.Version = *addr : addr=addr+4
header.SizeOf = *addr : addr=addr+4
header.NumVert = *addr : addr=addr+4
make memblock mb,12+(size*vert)
write memblock dword mb,pos,header.Version : pos=pos+4
write memblock dword mb,pos,header.SizeOf : pos=pos+4
write memblock dword mb,pos,header.NumVert : pos=pos+4
local pMemblock as dword = get memblock ptr(mb)
pMemblock=pMemblock+pos
copy memory *pMemblock,*pVertexBuffer,(header.SizeOf*header.NumVert)
make mesh from memblock mesh,mb
delete memblock mb
endfunction
`}
remstart
/*
Copyright© 2003 FMTau Labs, LLC. All Rights Reserved.
*/ 0.08.r1.alpha
remend
thats my latest offering on the subject

... the only realy bug with that right now is i couldn't fathom my head around bitshifting at 3am earlier hehee
so the FVF_SizeOf( ) doesn't yet work, and its not as indepth as i'd of liked ... but getting there
Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?