(1 item) |
|
(1 item) |
|
(5 items) |
|
(1 item) |
|
(1 item) |
|
(2 items) |
|
(2 items) |
|
(4 items) |
|
(1 item) |
|
(6 items) |
|
(2 items) |
|
(4 items) |
|
(1 item) |
|
(4 items) |
|
(2 items) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(2 items) |
|
(2 items) |
|
(5 items) |
|
(3 items) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(3 items) |
|
(1 item) |
|
(1 item) |
|
(2 items) |
|
(8 items) |
|
(2 items) |
|
(7 items) |
|
(2 items) |
|
(2 items) |
|
(1 item) |
|
(2 items) |
|
(1 item) |
|
(2 items) |
|
(4 items) |
|
(1 item) |
|
(5 items) |
|
(1 item) |
|
(3 items) |
|
(2 items) |
|
(2 items) |
|
(8 items) |
|
(7 items) |
|
(3 items) |
|
(7 items) |
|
(6 items) |
|
(1 item) |
|
(2 items) |
|
(5 items) |
|
(5 items) |
|
(7 items) |
|
(3 items) |
|
(7 items) |
|
(16 items) |
|
(10 items) |
|
(27 items) |
|
(15 items) |
|
(15 items) |
|
(13 items) |
|
(16 items) |
|
(15 items) |
[Update 2004/11/25: A new version of this utility, updated for the Avalon CTP release is now available here.]
Well somebody had to do it sooner or later:
This is a XAML file using Avalon's 3D features to show the ubiquitous teapot. I won't post the XAML inline in this blog because it's big - I'm sure nobody wants to read through 100K of XAML in their RSS aggregator, especially when it's almost entirely coordinates. But if you want to try it out, it's available in the ZIP that contains the utility I wrote to create it.
What utility is that, he asked rhetorically?
It's a little tool to work around the limitation that today, there's only one working 3D primitive in Avalon,
the MeshPrimitive3D
. There's no built-in way of importing external meshes, nor are there any
higher order primitives like cube, or sphere. There is the ImportedPrimitive3D
element, but that turns out not to be implemented in the current
build (4074 - WinHEC build). If it were, you'd be able to point it at a DirectX mesh file, in order to import externally-generated
meshes directly into your XAML scenes.
Wouldn't that be useful?
Well I thought so, which is why I wrote this tool as a stopgap: DXMeshToXaml (V1.0). (75KB. This zip
includes the source
and the XAML file used to generate the picture above.)
The way you use this tool is from the command line. Just pass in the path of the .x
file containing the
DirectX mesh you'd like to import, and it will generate the <MeshPrimitive3D.Mesh>
element for you.
(It prints it to standard output. You'll probably want to redirect that to a file.) You can then copy this into a
<MeshPrimitive>
element in the model of a <ViewPort3D>
file. (See
here for a little more information
on how to use these new 3D support elements in Avalon.)
Note that this tool requires the Managed DirectX runtime to be installed before it will work.
More importantly, note that this doesn't tool actually run on Longhorn, or at least not as Longhorn is configured out of the box. It will complain about the lack of Managed DX9 assemblies. (I think Longhorn's Managed DX assemblies are all marked as v10.) It might be possible to install the Managed DX9 bits on Longhorn, but I've not tried. For the time being, you'll need to do what I do, and run this conversion utility on some other box before copying its output over to your Longhorn machine.
This is a very rough and ready tool. I've only tried this on a few of the demo files in the DirectX 9 SDK. (It works fine on the dolphin, teapot and car models. I've not tried the rest.) If you use this and find it doesn't work on models you'd like to use, feel free to contact me to let me know where it doesn't work, and I'll see if I can fix the problem.