1
Vote

Adding lights, cameras in C#

description

This isn't really an issue - I'm sure it's possible to do - but could someone please help me to add lights and cameras in C#.
 
So far I have a XAML definition as follows:
<p:Workshop3D Name="ws3d" >
    <!--<p:XyzAxis3D></p:XyzAxis3D>-->
 
</p:Workshop3D>
 
I then use C#:
ws3d.Children.Add(new Perspective.Wpf3D.Shapes.XyzAxis3D());
Point3D position3d = new Point3D(8.1, -13, 11.3);
Vector3D lookDirection3d = new Vector3D(-0.0, 0.6, -0.4);
Vector3D upDirection3d = new Vector3D(0,0,1);
double fieldOfView = 50;
Camera camera = new PerspectiveCamera(position3d, lookDirection3d, upDirection3d, fieldOfView);
DirectionalLight light = new DirectionalLight(Colors.Cornsilk, new Vector3D(-2, -2, -2));
ws3d.Children.Add(light);
ws3d.Children.Add(camera);
 
So, obviously I can add my xyz axis, but the last two lines of this code both cause errors.
Any help gratefully received.
Thanks,
Bamboozled.

comments