Clootie graphics pages

Home | Articles | Projects | Delphi | C++Builder | TMT pascal | Links | About

DirectX for TMT pascal

TMT pascal pages:  | Home | News | SDK's | Samples |
DirectX samples for TMT pascal 4.0 compiler

Info field below contains Name / Date / Size with links to file and description field contains some notes about sample and screenshot from run-time.

Samples for DirectX 9.0

Info Sample description

70 Kb
Text3D image The Text3D sample uses ID3DXFont to display 2D text in a 3D scene. This is most useful for display stats, in game menus, etc... Note: new revision of ID3DXFont support UNICODE character rendering, so sample demostrates rendering of Japanese text (you should have installed Asian languages support to see them).
The sample also shows how to use D3DXCreateText() to create a D3DX mesh containing a 3D model of a text string. Note that D3DXCreateText may not work with certain types of fonts, such as bitmap fonts and some symbol fonts.

Download it (archive contains source and EXE, no media files needed).

Samples for DirectX 8.0

Info Sample description

Processing X-files with Direct3DX 8.x

In previous sample (generating X-files inside your program) "human face" is looking unnatural - like it's brushed out of stone. After some investigation I've discovered what normals in this model were calculated against single triangles and not smoothed over the face. Probably it was modeller intention, but I decided to correct this.
Generate X-File image So this sample shows how to use D3DXComputeNormals and D3DXWeldVertices functions of D3DX8 library to process meshes. On picture you can see (from left to right): original mesh, after D3DXComputeNormals and after D3DXWeldVertices.

Sample allows you modify input parameters to processing functions in realtime, see mesh statistics after processing, apply normal lighting or environment mapping on meshes, visualize mesh normals (right "face" on picture) and save processed meshes to disk.

Download source with EXE.

Generate X-File inside your program

Generate X-File image Sample demonstrate how to fill ID3DXMesh object from D3DX8 helper classes with your custom data and save final mesh to disk in either binary or text format. As user data face_data.pas was taken, containing data in pascal arrays from Jan Horm site. After generating files in current directory sample loads generated text format x-file "FaceText.x" and display it on screen.

Download source with EXE.

NitroFont image 1 These two samples demonstrate rendering of bitmap font format originally introduced by Nitro in FontStudio font editor and demonsrated in OpenGl FontTest application. Pros of font format: image with alpha channel, letter positions are stored in font file itself; cons: big file size, FontStudio generates monospace fonts.

NitroFont image 2 As shown in right picture DirectX font renderer class can be used to repeat all features of original OpenGL demo.
Font renderer is realized as class with functionalily equivalent to CD3DFont from MS DirectX SDK samples, so in addition to Nitro way of rendering text you can also draw text scaled to window dimentions, pure 2D font (with positions pointed in 2D viewport window) and "pure" 3D rendering. This is demostrated in other sample - slightly modified Text3D sample from MS DirectX 8.0 SDK - shown on left.
Note: If you ever wandered how to use memory mapped files - you may look in NitroFnt.pas font loading routine.
Font renderer class is DirectX 8.0 and DirectX 8.1 compatible.

Download source with exe's.
Pick image The EnhancedMesh sample shows how to use D3DX to load and enhance a mesh. The mesh is enhanced by increasing the vertex count.

Download source with exe.
Lighting image The Lighting sample shows how to use D3D lights when rendering. It shows the difference between the various types of lights (ambient, point, directional, spot), how to configure these lights, and how to enable and disable them.

Download source with exe.
Pick image The Pick sample shows how to implement "picking" which is finding which triangle in a mesh is intersected by a ray. In this case, the ray comes from mouse coordinates.

Download source with exe.

Please inform me of any grammar or general errors, contained on these pages, Alexey Barkovoy
Last updated: 22-Jan-2004