Life of a techno-guru
Tuesday, January 08, 2008
  Video Playing on top of WPF 3D Mesh
Here is a video of a video playing on top of a 3D mesh inside a Viewport3D in Windows Presentation Foundation:

http://www.youtube.com/watch?v=G2aPEHI16Fk


video
 
  C# Method to Set WPF PerspectiveCamera Target
Here's a method for Windows Presentation Foundation developers wanting to parse some text into a target location for a Camera, such as a PerspectiveCamera:

public static void SetCameraTarget(string Target, Camera Camera)
{
double[] TargetPoint = Array.ConvertAll(Target.Split(char.Parse(" ")), new Converter(DoubleStringConverter));
PerspectiveCamera MyCamera = (PerspectiveCamera)Camera;
Vector3D v1 = new Vector3D(MyCamera.Position.X, MyCamera.Position.Y, MyCamera.Position.Z);
Vector3D v2 = new Vector3D(TargetPoint[0], TargetPoint[1], TargetPoint[2]);
Vector3D NewVector = v2 - v1;
MyCamera.LookDirection = NewVector;
System.Diagnostics.Debug.WriteLine(NewVector);
}


Just pass a space-delimited string value into it with 3 double values such as: "2 5 3" and a reference to the camera object you want to update.

Oops, I almost forgot ... you need this too:

private double DoubleStringConverter(string StringToParse)
{
try
{
return Double.Parse(StringToParse);
}
catch
{
return 0;
}
}
 
My life of learning various things about technology including network administration, development, and 3D design

Name:
Location: Chicago, Illinois, United States
ARCHIVES
January 2006 / February 2006 / March 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / August 2007 / December 2007 / January 2008 / March 2008 / April 2008 / June 2008 / July 2008 / September 2008 / December 2008 / January 2009 / February 2009 / March 2009 / May 2009 /


Powered by Blogger