|
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.
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
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.
|
|
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.
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.
|
|
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.
|
|
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.
|
|
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.
|
|