Got bored so wrote this. It's nothing special, maybe a benchmark for D3DFuncs batch drawing feature.
If you already have the latest version of the plugin then you can compile the code:
` General Setup
Sync On : Sync Rate 0
Backdrop On : Color Backdrop 0
` Amount of scale normals
Global scale# = 1.0
Global CX#, CZ#
` Which object we're displaying
iCurrentType = 1 : ChangeObject(iCurrentType)
` Create font for text display
D3D_Font 1, "Tahoma", 9, 0, 0, 1
Do
` Display
D3D_StartText
D3D_Text 1, Screen Width() / 2, 0, 1, "FPS: " + Str$(Screen FPS())
D3D_Text 1, Screen Width() / 2, 14, 1, "Move mouse to rotate view"
D3D_Text 1, Screen Width() / 2, 28, 1, "Change object with spacebar"
D3D_EndText
` Update camera
MX = MouseMoveX() : NX# = Wrapvalue(NX# + MX) : NZ# = Wrapvalue(NZ# + MX)
Position Camera NewXValue(0, NX#, CX#), Camera Position Y(), NewZValue(0, NZ#, CZ#)
Point Camera 0, 0, 0
` Change object with spacekey
If Spacekey() = 0 And SpaceHit = 1
Inc iCurrentType
If iCurrentType > 9 Then iCurrentType = 1
ChangeObject(iCurrentType)
` Reset view rotation
NX# = 0 : NZ# = 0
EndIf
SpaceHit = Spacekey()
` No prizes for guessing what this does
DrawNormals()
Sync
Loop
Function DrawNormals()
`Lock Mesh
Lock VertexData For Limb 1, 0
` Vertex count
vCount = Get VertexData Vertex Count() - 1
` Setup batch
D3D_Batch_Set_Line3D (vCount + 1)
For i = 0 To vCount
` Read current vertex position
vX# = Get VertexData Position X(i)
vY# = Get VertexData Position Y(i)
vZ# = Get VertexData Position Z(i)
` Read current vertex normals (and scale)
vNX# = Get VertexData Normals X(i) * scale#
vNY# = Get VertexData Normals Y(i) * scale#
vNZ# = Get VertexData Normals Z(i) * scale#
` Add to batch
D3D_Batch_Add_Line3D vX#, vY#, vZ#, vX# + vNX#, vY# + vNY#, vZ# + vNZ#, 0xFF00FF00, 0xFFFF0000
Next i
` Draw batch
D3D_Batch_Draw_Line3D 0, 1, 0
` Unlock mesh
Unlock VertexData
EndFunction
Function ChangeObject(iType)
` Delete last object if it exists
If Object Exist(1) Then Delete Object 1
` Create new object
Select iType
Case 1 : Make Object Cube 1, 5 : scale# = 1.0 : CX# = 15 : CZ# = 15 : EndCase
Case 2 : Make Object Sphere 1, 5 : scale# = 1.0 : CX# = 15 : CZ# = 15 : EndCase
Case 3 : Make Object Cone 1, 5 : scale# = 1.0 : CX# = 15 : CZ# = 15 : EndCase
Case 4 : Make Object Cylinder 1, 5 : scale# = 1.0 : CX# = 15 : CZ# = 15 : EndCase
Case 5 : D3D_Make_Teapot 1 : scale# = 0.2 : CX# = 5 : CZ# = 5 : EndCase
Case 6 : Make Object Sphere 1, 5, 32, 32 : scale# = 1.0 : CX# = 15 : CZ# = 15 : EndCase
Case 7 : D3D_Make_Polygon 1, 12 : scale# = 0.2 : CX# = 5 : CZ# = 5 : EndCase
Case 8 : D3D_Make_Torus 1, 0.45, 1, 32, 32 : scale# = 0.2 : CX# = 5 : CZ# = 5 : EndCase
Case 9 : D3D_Make_Pyramid 1, 2, 2, 2 : scale# = 0.2 : CX# = 5 : CZ# = 5 : EndCase
EndSelect
EndFunction
If you don't have the latest plugin then go get it. If you don't have access to DBP currently, then I've attached a precompiled version.
Finally, a preview image.